
software.amazon.awssdk.services.managedblockchain.DefaultManagedBlockchainClient Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.managedblockchain;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.util.VersionInfo;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.managedblockchain.model.AccessDeniedException;
import software.amazon.awssdk.services.managedblockchain.model.CreateAccessorRequest;
import software.amazon.awssdk.services.managedblockchain.model.CreateAccessorResponse;
import software.amazon.awssdk.services.managedblockchain.model.CreateMemberRequest;
import software.amazon.awssdk.services.managedblockchain.model.CreateMemberResponse;
import software.amazon.awssdk.services.managedblockchain.model.CreateNetworkRequest;
import software.amazon.awssdk.services.managedblockchain.model.CreateNetworkResponse;
import software.amazon.awssdk.services.managedblockchain.model.CreateNodeRequest;
import software.amazon.awssdk.services.managedblockchain.model.CreateNodeResponse;
import software.amazon.awssdk.services.managedblockchain.model.CreateProposalRequest;
import software.amazon.awssdk.services.managedblockchain.model.CreateProposalResponse;
import software.amazon.awssdk.services.managedblockchain.model.DeleteAccessorRequest;
import software.amazon.awssdk.services.managedblockchain.model.DeleteAccessorResponse;
import software.amazon.awssdk.services.managedblockchain.model.DeleteMemberRequest;
import software.amazon.awssdk.services.managedblockchain.model.DeleteMemberResponse;
import software.amazon.awssdk.services.managedblockchain.model.DeleteNodeRequest;
import software.amazon.awssdk.services.managedblockchain.model.DeleteNodeResponse;
import software.amazon.awssdk.services.managedblockchain.model.GetAccessorRequest;
import software.amazon.awssdk.services.managedblockchain.model.GetAccessorResponse;
import software.amazon.awssdk.services.managedblockchain.model.GetMemberRequest;
import software.amazon.awssdk.services.managedblockchain.model.GetMemberResponse;
import software.amazon.awssdk.services.managedblockchain.model.GetNetworkRequest;
import software.amazon.awssdk.services.managedblockchain.model.GetNetworkResponse;
import software.amazon.awssdk.services.managedblockchain.model.GetNodeRequest;
import software.amazon.awssdk.services.managedblockchain.model.GetNodeResponse;
import software.amazon.awssdk.services.managedblockchain.model.GetProposalRequest;
import software.amazon.awssdk.services.managedblockchain.model.GetProposalResponse;
import software.amazon.awssdk.services.managedblockchain.model.IllegalActionException;
import software.amazon.awssdk.services.managedblockchain.model.InternalServiceErrorException;
import software.amazon.awssdk.services.managedblockchain.model.InvalidRequestException;
import software.amazon.awssdk.services.managedblockchain.model.ListAccessorsRequest;
import software.amazon.awssdk.services.managedblockchain.model.ListAccessorsResponse;
import software.amazon.awssdk.services.managedblockchain.model.ListInvitationsRequest;
import software.amazon.awssdk.services.managedblockchain.model.ListInvitationsResponse;
import software.amazon.awssdk.services.managedblockchain.model.ListMembersRequest;
import software.amazon.awssdk.services.managedblockchain.model.ListMembersResponse;
import software.amazon.awssdk.services.managedblockchain.model.ListNetworksRequest;
import software.amazon.awssdk.services.managedblockchain.model.ListNetworksResponse;
import software.amazon.awssdk.services.managedblockchain.model.ListNodesRequest;
import software.amazon.awssdk.services.managedblockchain.model.ListNodesResponse;
import software.amazon.awssdk.services.managedblockchain.model.ListProposalVotesRequest;
import software.amazon.awssdk.services.managedblockchain.model.ListProposalVotesResponse;
import software.amazon.awssdk.services.managedblockchain.model.ListProposalsRequest;
import software.amazon.awssdk.services.managedblockchain.model.ListProposalsResponse;
import software.amazon.awssdk.services.managedblockchain.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.managedblockchain.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.managedblockchain.model.ManagedBlockchainException;
import software.amazon.awssdk.services.managedblockchain.model.ManagedBlockchainRequest;
import software.amazon.awssdk.services.managedblockchain.model.RejectInvitationRequest;
import software.amazon.awssdk.services.managedblockchain.model.RejectInvitationResponse;
import software.amazon.awssdk.services.managedblockchain.model.ResourceAlreadyExistsException;
import software.amazon.awssdk.services.managedblockchain.model.ResourceLimitExceededException;
import software.amazon.awssdk.services.managedblockchain.model.ResourceNotFoundException;
import software.amazon.awssdk.services.managedblockchain.model.ResourceNotReadyException;
import software.amazon.awssdk.services.managedblockchain.model.TagResourceRequest;
import software.amazon.awssdk.services.managedblockchain.model.TagResourceResponse;
import software.amazon.awssdk.services.managedblockchain.model.ThrottlingException;
import software.amazon.awssdk.services.managedblockchain.model.TooManyTagsException;
import software.amazon.awssdk.services.managedblockchain.model.UntagResourceRequest;
import software.amazon.awssdk.services.managedblockchain.model.UntagResourceResponse;
import software.amazon.awssdk.services.managedblockchain.model.UpdateMemberRequest;
import software.amazon.awssdk.services.managedblockchain.model.UpdateMemberResponse;
import software.amazon.awssdk.services.managedblockchain.model.UpdateNodeRequest;
import software.amazon.awssdk.services.managedblockchain.model.UpdateNodeResponse;
import software.amazon.awssdk.services.managedblockchain.model.VoteOnProposalRequest;
import software.amazon.awssdk.services.managedblockchain.model.VoteOnProposalResponse;
import software.amazon.awssdk.services.managedblockchain.paginators.ListAccessorsIterable;
import software.amazon.awssdk.services.managedblockchain.paginators.ListInvitationsIterable;
import software.amazon.awssdk.services.managedblockchain.paginators.ListMembersIterable;
import software.amazon.awssdk.services.managedblockchain.paginators.ListNetworksIterable;
import software.amazon.awssdk.services.managedblockchain.paginators.ListNodesIterable;
import software.amazon.awssdk.services.managedblockchain.paginators.ListProposalVotesIterable;
import software.amazon.awssdk.services.managedblockchain.paginators.ListProposalsIterable;
import software.amazon.awssdk.services.managedblockchain.transform.CreateAccessorRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.CreateMemberRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.CreateNetworkRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.CreateNodeRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.CreateProposalRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.DeleteAccessorRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.DeleteMemberRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.DeleteNodeRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.GetAccessorRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.GetMemberRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.GetNetworkRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.GetNodeRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.GetProposalRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.ListAccessorsRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.ListInvitationsRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.ListMembersRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.ListNetworksRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.ListNodesRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.ListProposalVotesRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.ListProposalsRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.RejectInvitationRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.UpdateMemberRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.UpdateNodeRequestMarshaller;
import software.amazon.awssdk.services.managedblockchain.transform.VoteOnProposalRequestMarshaller;
import software.amazon.awssdk.utils.Logger;
/**
* Internal implementation of {@link ManagedBlockchainClient}.
*
* @see ManagedBlockchainClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultManagedBlockchainClient implements ManagedBlockchainClient {
private static final Logger log = Logger.loggerFor(DefaultManagedBlockchainClient.class);
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultManagedBlockchainClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
*
* The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is subject to
* change. We recommend that you use this feature only with test scenarios, and not in production environments.
*
*
*
* Creates a new accessor for use with Managed Blockchain Ethereum nodes. An accessor object is a container that has
* the information required for token based access to your Ethereum nodes.
*
*
* @param createAccessorRequest
* @return Result of the CreateAccessor operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceAlreadyExistsException
* A resource request is issued for a resource that already exists.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws ResourceLimitExceededException
* The maximum number of resources of that type already exist. Ensure the resources requested are within the
* boundaries of the service edition and your account limits.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.CreateAccessor
* @see AWS API Documentation
*/
@Override
public CreateAccessorResponse createAccessor(CreateAccessorRequest createAccessorRequest) throws InvalidRequestException,
AccessDeniedException, ResourceAlreadyExistsException, ThrottlingException, ResourceLimitExceededException,
InternalServiceErrorException, AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateAccessorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createAccessorRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAccessor");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateAccessor").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createAccessorRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateAccessorRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a member within a Managed Blockchain network.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param createMemberRequest
* @return Result of the CreateMember operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ResourceAlreadyExistsException
* A resource request is issued for a resource that already exists.
* @throws ResourceNotReadyException
* The requested resource exists but isn't in a status that can complete the operation.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws ResourceLimitExceededException
* The maximum number of resources of that type already exist. Ensure the resources requested are within the
* boundaries of the service edition and your account limits.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws TooManyTagsException
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.CreateMember
* @see AWS API Documentation
*/
@Override
public CreateMemberResponse createMember(CreateMemberRequest createMemberRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ResourceAlreadyExistsException, ResourceNotReadyException,
ThrottlingException, ResourceLimitExceededException, InternalServiceErrorException, TooManyTagsException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateMemberResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createMemberRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateMember");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateMember").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createMemberRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateMemberRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a new blockchain network using Amazon Managed Blockchain.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param createNetworkRequest
* @return Result of the CreateNetwork operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceAlreadyExistsException
* A resource request is issued for a resource that already exists.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws ResourceLimitExceededException
* The maximum number of resources of that type already exist. Ensure the resources requested are within the
* boundaries of the service edition and your account limits.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws TooManyTagsException
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.CreateNetwork
* @see AWS API Documentation
*/
@Override
public CreateNetworkResponse createNetwork(CreateNetworkRequest createNetworkRequest) throws InvalidRequestException,
AccessDeniedException, ResourceAlreadyExistsException, ThrottlingException, ResourceLimitExceededException,
InternalServiceErrorException, TooManyTagsException, AwsServiceException, SdkClientException,
ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateNetworkResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createNetworkRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateNetwork");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateNetwork").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createNetworkRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateNetworkRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a node on the specified blockchain network.
*
*
* Applies to Hyperledger Fabric and Ethereum.
*
*
* @param createNodeRequest
* @return Result of the CreateNode operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ResourceAlreadyExistsException
* A resource request is issued for a resource that already exists.
* @throws ResourceNotReadyException
* The requested resource exists but isn't in a status that can complete the operation.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws ResourceLimitExceededException
* The maximum number of resources of that type already exist. Ensure the resources requested are within the
* boundaries of the service edition and your account limits.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws TooManyTagsException
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.CreateNode
* @see AWS
* API Documentation
*/
@Override
public CreateNodeResponse createNode(CreateNodeRequest createNodeRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ResourceAlreadyExistsException, ResourceNotReadyException,
ThrottlingException, ResourceLimitExceededException, InternalServiceErrorException, TooManyTagsException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateNodeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createNodeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateNode");
return clientHandler
.execute(new ClientExecutionParams().withOperationName("CreateNode")
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(createNodeRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateNodeRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a proposal for a change to the network that other members of the network can vote on, for example, a
* proposal to add a new member to the network. Any member can create a proposal.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param createProposalRequest
* @return Result of the CreateProposal operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ResourceNotReadyException
* The requested resource exists but isn't in a status that can complete the operation.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws TooManyTagsException
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.CreateProposal
* @see AWS API Documentation
*/
@Override
public CreateProposalResponse createProposal(CreateProposalRequest createProposalRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ResourceNotReadyException, ThrottlingException,
InternalServiceErrorException, TooManyTagsException, AwsServiceException, SdkClientException,
ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateProposalResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createProposalRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateProposal");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateProposal").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createProposalRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateProposalRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
*
* The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is subject to
* change. We recommend that you use this feature only with test scenarios, and not in production environments.
*
*
*
* Deletes an accessor that your Amazon Web Services account owns. An accessor object is a container that has the
* information required for token based access to your Ethereum nodes including, the BILLING_TOKEN
.
* After an accessor is deleted, the status of the accessor changes from AVAILABLE
to
* PENDING_DELETION
. An accessor in the PENDING_DELETION
state can’t be used for new
* WebSocket requests or HTTP requests. However, WebSocket connections that are initiated while the accessor was in
* the AVAILABLE
state remain open until they expire (up to 2 hours).
*
*
* @param deleteAccessorRequest
* @return Result of the DeleteAccessor operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.DeleteAccessor
* @see AWS API Documentation
*/
@Override
public DeleteAccessorResponse deleteAccessor(DeleteAccessorRequest deleteAccessorRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ThrottlingException, InternalServiceErrorException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteAccessorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAccessorRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAccessor");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteAccessor").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteAccessorRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteAccessorRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a member. Deleting a member removes the member and all associated resources from the network.
* DeleteMember
can only be called for a specified MemberId
if the principal performing
* the action is associated with the Amazon Web Services account that owns the member. In all other cases, the
* DeleteMember
action is carried out as the result of an approved proposal to remove a member. If
* MemberId
is the last member in a network specified by the last Amazon Web Services account, the
* network is deleted also.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param deleteMemberRequest
* @return Result of the DeleteMember operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ResourceNotReadyException
* The requested resource exists but isn't in a status that can complete the operation.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.DeleteMember
* @see AWS API Documentation
*/
@Override
public DeleteMemberResponse deleteMember(DeleteMemberRequest deleteMemberRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ResourceNotReadyException, ThrottlingException,
InternalServiceErrorException, AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteMemberResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteMemberRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteMember");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteMember").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteMemberRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteMemberRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a node that your Amazon Web Services account owns. All data on the node is lost and cannot be recovered.
*
*
* Applies to Hyperledger Fabric and Ethereum.
*
*
* @param deleteNodeRequest
* @return Result of the DeleteNode operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ResourceNotReadyException
* The requested resource exists but isn't in a status that can complete the operation.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.DeleteNode
* @see AWS
* API Documentation
*/
@Override
public DeleteNodeResponse deleteNode(DeleteNodeRequest deleteNodeRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ResourceNotReadyException, ThrottlingException,
InternalServiceErrorException, AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteNodeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteNodeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteNode");
return clientHandler
.execute(new ClientExecutionParams().withOperationName("DeleteNode")
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(deleteNodeRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteNodeRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
*
* The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is subject to
* change. We recommend that you use this feature only with test scenarios, and not in production environments.
*
*
*
* Returns detailed information about an accessor. An accessor object is a container that has the information
* required for token based access to your Ethereum nodes.
*
*
* @param getAccessorRequest
* @return Result of the GetAccessor operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.GetAccessor
* @see AWS
* API Documentation
*/
@Override
public GetAccessorResponse getAccessor(GetAccessorRequest getAccessorRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ThrottlingException, InternalServiceErrorException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetAccessorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getAccessorRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAccessor");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetAccessor").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getAccessorRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetAccessorRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns detailed information about a member.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param getMemberRequest
* @return Result of the GetMember operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.GetMember
* @see AWS
* API Documentation
*/
@Override
public GetMemberResponse getMember(GetMemberRequest getMemberRequest) throws InvalidRequestException, AccessDeniedException,
ResourceNotFoundException, ThrottlingException, InternalServiceErrorException, AwsServiceException,
SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetMemberResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getMemberRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetMember");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetMember").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getMemberRequest)
.withMetricCollector(apiCallMetricCollector).withMarshaller(new GetMemberRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns detailed information about a network.
*
*
* Applies to Hyperledger Fabric and Ethereum.
*
*
* @param getNetworkRequest
* @return Result of the GetNetwork operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.GetNetwork
* @see AWS
* API Documentation
*/
@Override
public GetNetworkResponse getNetwork(GetNetworkRequest getNetworkRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ThrottlingException, InternalServiceErrorException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetNetworkResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getNetworkRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetNetwork");
return clientHandler
.execute(new ClientExecutionParams().withOperationName("GetNetwork")
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(getNetworkRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetNetworkRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns detailed information about a node.
*
*
* Applies to Hyperledger Fabric and Ethereum.
*
*
* @param getNodeRequest
* @return Result of the GetNode operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.GetNode
* @see AWS API
* Documentation
*/
@Override
public GetNodeResponse getNode(GetNodeRequest getNodeRequest) throws InvalidRequestException, AccessDeniedException,
ResourceNotFoundException, ThrottlingException, InternalServiceErrorException, AwsServiceException,
SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetNodeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getNodeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetNode");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetNode").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getNodeRequest)
.withMetricCollector(apiCallMetricCollector).withMarshaller(new GetNodeRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns detailed information about a proposal.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param getProposalRequest
* @return Result of the GetProposal operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.GetProposal
* @see AWS
* API Documentation
*/
@Override
public GetProposalResponse getProposal(GetProposalRequest getProposalRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ThrottlingException, InternalServiceErrorException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetProposalResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getProposalRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetProposal");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetProposal").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getProposalRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetProposalRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
*
* The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is subject to
* change. We recommend that you use this feature only with test scenarios, and not in production environments.
*
*
*
* Returns a list of the accessors and their properties. Accessor objects are containers that have the information
* required for token based access to your Ethereum nodes.
*
*
* @param listAccessorsRequest
* @return Result of the ListAccessors operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListAccessors
* @see AWS API Documentation
*/
@Override
public ListAccessorsResponse listAccessors(ListAccessorsRequest listAccessorsRequest) throws InvalidRequestException,
AccessDeniedException, ThrottlingException, InternalServiceErrorException, AwsServiceException, SdkClientException,
ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListAccessorsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listAccessorsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListAccessors");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListAccessors").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listAccessorsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListAccessorsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
*
* The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is subject to
* change. We recommend that you use this feature only with test scenarios, and not in production environments.
*
*
*
* Returns a list of the accessors and their properties. Accessor objects are containers that have the information
* required for token based access to your Ethereum nodes.
*
*
*
* This is a variant of
* {@link #listAccessors(software.amazon.awssdk.services.managedblockchain.model.ListAccessorsRequest)} operation.
* The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally
* handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListAccessorsIterable responses = client.listAccessorsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.managedblockchain.paginators.ListAccessorsIterable responses = client
* .listAccessorsPaginator(request);
* for (software.amazon.awssdk.services.managedblockchain.model.ListAccessorsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListAccessorsIterable responses = client.listAccessorsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listAccessors(software.amazon.awssdk.services.managedblockchain.model.ListAccessorsRequest)}
* operation.
*
*
* @param listAccessorsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListAccessors
* @see AWS API Documentation
*/
@Override
public ListAccessorsIterable listAccessorsPaginator(ListAccessorsRequest listAccessorsRequest)
throws InvalidRequestException, AccessDeniedException, ThrottlingException, InternalServiceErrorException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
return new ListAccessorsIterable(this, applyPaginatorUserAgent(listAccessorsRequest));
}
/**
*
* Returns a list of all invitations for the current Amazon Web Services account.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param listInvitationsRequest
* @return Result of the ListInvitations operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws ResourceLimitExceededException
* The maximum number of resources of that type already exist. Ensure the resources requested are within the
* boundaries of the service edition and your account limits.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListInvitations
* @see AWS API Documentation
*/
@Override
public ListInvitationsResponse listInvitations(ListInvitationsRequest listInvitationsRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ThrottlingException, ResourceLimitExceededException,
InternalServiceErrorException, AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListInvitationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listInvitationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListInvitations");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListInvitations").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listInvitationsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListInvitationsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of all invitations for the current Amazon Web Services account.
*
*
* Applies only to Hyperledger Fabric.
*
*
*
* This is a variant of
* {@link #listInvitations(software.amazon.awssdk.services.managedblockchain.model.ListInvitationsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListInvitationsIterable responses = client.listInvitationsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.managedblockchain.paginators.ListInvitationsIterable responses = client
* .listInvitationsPaginator(request);
* for (software.amazon.awssdk.services.managedblockchain.model.ListInvitationsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListInvitationsIterable responses = client.listInvitationsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listInvitations(software.amazon.awssdk.services.managedblockchain.model.ListInvitationsRequest)}
* operation.
*
*
* @param listInvitationsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws ResourceLimitExceededException
* The maximum number of resources of that type already exist. Ensure the resources requested are within the
* boundaries of the service edition and your account limits.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListInvitations
* @see AWS API Documentation
*/
@Override
public ListInvitationsIterable listInvitationsPaginator(ListInvitationsRequest listInvitationsRequest)
throws InvalidRequestException, AccessDeniedException, ResourceNotFoundException, ThrottlingException,
ResourceLimitExceededException, InternalServiceErrorException, AwsServiceException, SdkClientException,
ManagedBlockchainException {
return new ListInvitationsIterable(this, applyPaginatorUserAgent(listInvitationsRequest));
}
/**
*
* Returns a list of the members in a network and properties of their configurations.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param listMembersRequest
* @return Result of the ListMembers operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListMembers
* @see AWS
* API Documentation
*/
@Override
public ListMembersResponse listMembers(ListMembersRequest listMembersRequest) throws InvalidRequestException,
AccessDeniedException, ThrottlingException, InternalServiceErrorException, AwsServiceException, SdkClientException,
ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListMembersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listMembersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListMembers");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListMembers").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listMembersRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListMembersRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of the members in a network and properties of their configurations.
*
*
* Applies only to Hyperledger Fabric.
*
*
*
* This is a variant of
* {@link #listMembers(software.amazon.awssdk.services.managedblockchain.model.ListMembersRequest)} operation. The
* return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle
* making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListMembersIterable responses = client.listMembersPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.managedblockchain.paginators.ListMembersIterable responses = client
* .listMembersPaginator(request);
* for (software.amazon.awssdk.services.managedblockchain.model.ListMembersResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListMembersIterable responses = client.listMembersPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listMembers(software.amazon.awssdk.services.managedblockchain.model.ListMembersRequest)} operation.
*
*
* @param listMembersRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListMembers
* @see AWS
* API Documentation
*/
@Override
public ListMembersIterable listMembersPaginator(ListMembersRequest listMembersRequest) throws InvalidRequestException,
AccessDeniedException, ThrottlingException, InternalServiceErrorException, AwsServiceException, SdkClientException,
ManagedBlockchainException {
return new ListMembersIterable(this, applyPaginatorUserAgent(listMembersRequest));
}
/**
*
* Returns information about the networks in which the current Amazon Web Services account participates.
*
*
* Applies to Hyperledger Fabric and Ethereum.
*
*
* @param listNetworksRequest
* @return Result of the ListNetworks operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListNetworks
* @see AWS API Documentation
*/
@Override
public ListNetworksResponse listNetworks(ListNetworksRequest listNetworksRequest) throws InvalidRequestException,
AccessDeniedException, ThrottlingException, InternalServiceErrorException, AwsServiceException, SdkClientException,
ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListNetworksResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listNetworksRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListNetworks");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListNetworks").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listNetworksRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListNetworksRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about the networks in which the current Amazon Web Services account participates.
*
*
* Applies to Hyperledger Fabric and Ethereum.
*
*
*
* This is a variant of
* {@link #listNetworks(software.amazon.awssdk.services.managedblockchain.model.ListNetworksRequest)} operation. The
* return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle
* making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListNetworksIterable responses = client.listNetworksPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.managedblockchain.paginators.ListNetworksIterable responses = client
* .listNetworksPaginator(request);
* for (software.amazon.awssdk.services.managedblockchain.model.ListNetworksResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListNetworksIterable responses = client.listNetworksPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listNetworks(software.amazon.awssdk.services.managedblockchain.model.ListNetworksRequest)} operation.
*
*
* @param listNetworksRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListNetworks
* @see AWS API Documentation
*/
@Override
public ListNetworksIterable listNetworksPaginator(ListNetworksRequest listNetworksRequest) throws InvalidRequestException,
AccessDeniedException, ThrottlingException, InternalServiceErrorException, AwsServiceException, SdkClientException,
ManagedBlockchainException {
return new ListNetworksIterable(this, applyPaginatorUserAgent(listNetworksRequest));
}
/**
*
* Returns information about the nodes within a network.
*
*
* Applies to Hyperledger Fabric and Ethereum.
*
*
* @param listNodesRequest
* @return Result of the ListNodes operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListNodes
* @see AWS
* API Documentation
*/
@Override
public ListNodesResponse listNodes(ListNodesRequest listNodesRequest) throws InvalidRequestException, AccessDeniedException,
ThrottlingException, InternalServiceErrorException, AwsServiceException, SdkClientException,
ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListNodesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listNodesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListNodes");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListNodes").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listNodesRequest)
.withMetricCollector(apiCallMetricCollector).withMarshaller(new ListNodesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about the nodes within a network.
*
*
* Applies to Hyperledger Fabric and Ethereum.
*
*
*
* This is a variant of {@link #listNodes(software.amazon.awssdk.services.managedblockchain.model.ListNodesRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListNodesIterable responses = client.listNodesPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.managedblockchain.paginators.ListNodesIterable responses = client.listNodesPaginator(request);
* for (software.amazon.awssdk.services.managedblockchain.model.ListNodesResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListNodesIterable responses = client.listNodesPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listNodes(software.amazon.awssdk.services.managedblockchain.model.ListNodesRequest)} operation.
*
*
* @param listNodesRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListNodes
* @see AWS
* API Documentation
*/
@Override
public ListNodesIterable listNodesPaginator(ListNodesRequest listNodesRequest) throws InvalidRequestException,
AccessDeniedException, ThrottlingException, InternalServiceErrorException, AwsServiceException, SdkClientException,
ManagedBlockchainException {
return new ListNodesIterable(this, applyPaginatorUserAgent(listNodesRequest));
}
/**
*
* Returns the list of votes for a specified proposal, including the value of each vote and the unique identifier of
* the member that cast the vote.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param listProposalVotesRequest
* @return Result of the ListProposalVotes operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListProposalVotes
* @see AWS API Documentation
*/
@Override
public ListProposalVotesResponse listProposalVotes(ListProposalVotesRequest listProposalVotesRequest)
throws InvalidRequestException, AccessDeniedException, ThrottlingException, InternalServiceErrorException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListProposalVotesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listProposalVotesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListProposalVotes");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListProposalVotes").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listProposalVotesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListProposalVotesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the list of votes for a specified proposal, including the value of each vote and the unique identifier of
* the member that cast the vote.
*
*
* Applies only to Hyperledger Fabric.
*
*
*
* This is a variant of
* {@link #listProposalVotes(software.amazon.awssdk.services.managedblockchain.model.ListProposalVotesRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListProposalVotesIterable responses = client.listProposalVotesPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.managedblockchain.paginators.ListProposalVotesIterable responses = client
* .listProposalVotesPaginator(request);
* for (software.amazon.awssdk.services.managedblockchain.model.ListProposalVotesResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListProposalVotesIterable responses = client.listProposalVotesPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listProposalVotes(software.amazon.awssdk.services.managedblockchain.model.ListProposalVotesRequest)}
* operation.
*
*
* @param listProposalVotesRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListProposalVotes
* @see AWS API Documentation
*/
@Override
public ListProposalVotesIterable listProposalVotesPaginator(ListProposalVotesRequest listProposalVotesRequest)
throws InvalidRequestException, AccessDeniedException, ThrottlingException, InternalServiceErrorException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
return new ListProposalVotesIterable(this, applyPaginatorUserAgent(listProposalVotesRequest));
}
/**
*
* Returns a list of proposals for the network.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param listProposalsRequest
* @return Result of the ListProposals operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListProposals
* @see AWS API Documentation
*/
@Override
public ListProposalsResponse listProposals(ListProposalsRequest listProposalsRequest) throws InvalidRequestException,
ResourceNotFoundException, AccessDeniedException, ThrottlingException, InternalServiceErrorException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListProposalsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listProposalsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListProposals");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListProposals").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listProposalsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListProposalsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of proposals for the network.
*
*
* Applies only to Hyperledger Fabric.
*
*
*
* This is a variant of
* {@link #listProposals(software.amazon.awssdk.services.managedblockchain.model.ListProposalsRequest)} operation.
* The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally
* handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListProposalsIterable responses = client.listProposalsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.managedblockchain.paginators.ListProposalsIterable responses = client
* .listProposalsPaginator(request);
* for (software.amazon.awssdk.services.managedblockchain.model.ListProposalsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.managedblockchain.paginators.ListProposalsIterable responses = client.listProposalsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listProposals(software.amazon.awssdk.services.managedblockchain.model.ListProposalsRequest)}
* operation.
*
*
* @param listProposalsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListProposals
* @see AWS API Documentation
*/
@Override
public ListProposalsIterable listProposalsPaginator(ListProposalsRequest listProposalsRequest)
throws InvalidRequestException, ResourceNotFoundException, AccessDeniedException, ThrottlingException,
InternalServiceErrorException, AwsServiceException, SdkClientException, ManagedBlockchainException {
return new ListProposalsIterable(this, applyPaginatorUserAgent(listProposalsRequest));
}
/**
*
* Returns a list of tags for the specified resource. Each tag consists of a key and optional value.
*
*
* For more information about tags, see Tagging
* Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide.
*
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ResourceNotReadyException
* The requested resource exists but isn't in a status that can complete the operation.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.ListTagsForResource
* @see AWS API Documentation
*/
@Override
public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest)
throws InternalServiceErrorException, InvalidRequestException, ResourceNotFoundException, ResourceNotReadyException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listTagsForResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Rejects an invitation to join a network. This action can be called by a principal in an Amazon Web Services
* account that has received an invitation to create a member and join a network.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param rejectInvitationRequest
* @return Result of the RejectInvitation operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws IllegalActionException
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.RejectInvitation
* @see AWS API Documentation
*/
@Override
public RejectInvitationResponse rejectInvitation(RejectInvitationRequest rejectInvitationRequest)
throws InvalidRequestException, IllegalActionException, AccessDeniedException, ResourceNotFoundException,
ThrottlingException, InternalServiceErrorException, AwsServiceException, SdkClientException,
ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
RejectInvitationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, rejectInvitationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RejectInvitation");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("RejectInvitation").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(rejectInvitationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new RejectInvitationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Adds or overwrites the specified tags for the specified Amazon Managed Blockchain resource. Each tag consists of
* a key and optional value.
*
*
* When you specify a tag key that already exists, the tag value is overwritten with the new value. Use
* UntagResource
to remove tag keys.
*
*
* A resource can have up to 50 tags. If you try to create more than 50 tags for a resource, your request fails and
* returns an error.
*
*
* For more information about tags, see Tagging
* Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide.
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws TooManyTagsException
* @throws ResourceNotReadyException
* The requested resource exists but isn't in a status that can complete the operation.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.TagResource
* @see AWS
* API Documentation
*/
@Override
public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws InternalServiceErrorException,
InvalidRequestException, ResourceNotFoundException, TooManyTagsException, ResourceNotReadyException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("TagResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(tagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new TagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes the specified tags from the Amazon Managed Blockchain resource.
*
*
* For more information about tags, see Tagging
* Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ResourceNotReadyException
* The requested resource exists but isn't in a status that can complete the operation.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.UntagResource
* @see AWS API Documentation
*/
@Override
public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws InternalServiceErrorException,
InvalidRequestException, ResourceNotFoundException, ResourceNotReadyException, AwsServiceException,
SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UntagResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(untagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates a member configuration with new parameters.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param updateMemberRequest
* @return Result of the UpdateMember operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.UpdateMember
* @see AWS API Documentation
*/
@Override
public UpdateMemberResponse updateMember(UpdateMemberRequest updateMemberRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ThrottlingException, InternalServiceErrorException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateMemberResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateMemberRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateMember");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateMember").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateMemberRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateMemberRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates a node configuration with new parameters.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param updateNodeRequest
* @return Result of the UpdateNode operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.UpdateNode
* @see AWS
* API Documentation
*/
@Override
public UpdateNodeResponse updateNode(UpdateNodeRequest updateNodeRequest) throws InvalidRequestException,
AccessDeniedException, ResourceNotFoundException, ThrottlingException, InternalServiceErrorException,
AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateNodeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateNodeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateNode");
return clientHandler
.execute(new ClientExecutionParams().withOperationName("UpdateNode")
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(updateNodeRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateNodeRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Casts a vote for a specified ProposalId
on behalf of a member. The member to vote as, specified by
* VoterMemberId
, must be in the same Amazon Web Services account as the principal that calls the
* action.
*
*
* Applies only to Hyperledger Fabric.
*
*
* @param voteOnProposalRequest
* @return Result of the VoteOnProposal operation returned by the service.
* @throws InvalidRequestException
* The action or operation requested is invalid. Verify that the action is typed correctly.
* @throws IllegalActionException
* @throws AccessDeniedException
* You don't have sufficient access to perform this action.
* @throws ResourceNotFoundException
* A requested resource doesn't exist. It may have been deleted or referenced incorrectly.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is creating resources that exceed your service limit for this resource type.
* Request a limit increase or delete unused resources if possible.
* @throws InternalServiceErrorException
* The request processing has failed because of an unknown error, exception or failure.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ManagedBlockchainException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ManagedBlockchainClient.VoteOnProposal
* @see AWS API Documentation
*/
@Override
public VoteOnProposalResponse voteOnProposal(VoteOnProposalRequest voteOnProposalRequest) throws InvalidRequestException,
IllegalActionException, AccessDeniedException, ResourceNotFoundException, ThrottlingException,
InternalServiceErrorException, AwsServiceException, SdkClientException, ManagedBlockchainException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
VoteOnProposalResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, voteOnProposalRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ManagedBlockchain");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "VoteOnProposal");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("VoteOnProposal").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(voteOnProposalRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new VoteOnProposalRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
}
if (publishers == null || publishers.isEmpty()) {
publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
}
if (publishers == null) {
publishers = Collections.emptyList();
}
return publishers;
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(ManagedBlockchainException::builder)
.protocol(AwsJsonProtocol.REST_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidRequestException")
.exceptionBuilderSupplier(InvalidRequestException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotReadyException")
.exceptionBuilderSupplier(ResourceNotReadyException::builder).httpStatusCode(409).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ThrottlingException")
.exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(429).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("IllegalActionException")
.exceptionBuilderSupplier(IllegalActionException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("AccessDeniedException")
.exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(403).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("TooManyTagsException")
.exceptionBuilderSupplier(TooManyTagsException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(404).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalServiceErrorException")
.exceptionBuilderSupplier(InternalServiceErrorException::builder).httpStatusCode(500).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceAlreadyExistsException")
.exceptionBuilderSupplier(ResourceAlreadyExistsException::builder).httpStatusCode(409).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceLimitExceededException")
.exceptionBuilderSupplier(ResourceLimitExceededException::builder).httpStatusCode(429).build());
}
@Override
public void close() {
clientHandler.close();
}
private T applyPaginatorUserAgent(T request) {
Consumer userAgentApplier = b -> b.addApiName(ApiName.builder()
.version(VersionInfo.SDK_VERSION).name("PAGINATED").build());
AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration()
.map(c -> c.toBuilder().applyMutation(userAgentApplier).build())
.orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build()));
return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
}