This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 38a00fdfbf13b85a78318e52e8f910861fbd90db Author: Andrea Cosentino <[email protected]> AuthorDate: Tue Jul 24 11:22:45 2018 +0200 CAMEL-12238 - Camel-AWS: Create an IAM component, first commit --- .../camel/component/aws/iam/IAMComponent.java | 118 +++ .../aws/iam/IAMComponentVerifierExtension.java | 87 +++ .../camel/component/aws/iam/IAMConfiguration.java | 139 ++++ .../camel/component/aws/iam/IAMConstants.java | 29 + .../camel/component/aws/iam/IAMEndpoint.java | 122 +++ .../camel/component/aws/iam/IAMOperations.java | 22 + .../camel/component/aws/iam/IAMProducer.java | 93 +++ .../services/org/apache/camel/component/aws-iam | 18 + .../component/aws/iam/AmazonIAMClientMock.java | 833 +++++++++++++++++++++ .../aws/iam/IAMComponentConfigurationTest.java | 51 ++ .../aws/iam/IAMComponentVerifierExtensionTest.java | 73 ++ .../component/aws/iam/IAMProducerSpringTest.java | 57 ++ .../camel/component/aws/iam/IAMProducerTest.java | 74 ++ .../aws/iam/IAMComponentSpringTest-context.xml | 35 + .../springboot/IAMComponentAutoConfiguration.java | 128 ++++ .../iam/springboot/IAMComponentConfiguration.java | 193 +++++ .../src/main/resources/META-INF/spring.factories | 4 +- 17 files changed, 2075 insertions(+), 1 deletion(-) diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMComponent.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMComponent.java new file mode 100644 index 0000000..85cb8f9 --- /dev/null +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMComponent.java @@ -0,0 +1,118 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.Endpoint; +import org.apache.camel.impl.DefaultComponent; +import org.apache.camel.spi.Metadata; +import org.apache.camel.util.ObjectHelper; + +/** + * For working with Amazon KMS. + */ +public class IAMComponent extends DefaultComponent { + + @Metadata + private String accessKey; + @Metadata + private String secretKey; + @Metadata + private String region; + @Metadata(label = "advanced") + private IAMConfiguration configuration; + + public IAMComponent() { + this(null); + } + + public IAMComponent(CamelContext context) { + super(context); + + this.configuration = new IAMConfiguration(); + registerExtension(new IAMComponentVerifierExtension()); + } + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + IAMConfiguration configuration = this.configuration.copy(); + setProperties(configuration, parameters); + + if (ObjectHelper.isEmpty(configuration.getAccessKey())) { + setAccessKey(accessKey); + } + if (ObjectHelper.isEmpty(configuration.getSecretKey())) { + setSecretKey(secretKey); + } + if (ObjectHelper.isEmpty(configuration.getRegion())) { + setRegion(region); + } + if (configuration.getIamClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) { + throw new IllegalArgumentException("Amazon IAM client or accessKey and secretKey must be specified"); + } + + IAMEndpoint endpoint = new IAMEndpoint(uri, this, configuration); + return endpoint; + } + + public IAMConfiguration getConfiguration() { + return configuration; + } + + /** + * The AWS MQ default configuration + */ + public void setConfiguration(IAMConfiguration configuration) { + this.configuration = configuration; + } + + public String getAccessKey() { + return configuration.getAccessKey(); + } + + /** + * Amazon AWS Access Key + */ + public void setAccessKey(String accessKey) { + configuration.setAccessKey(accessKey); + } + + public String getSecretKey() { + return configuration.getSecretKey(); + } + + /** + * Amazon AWS Secret Key + */ + public void setSecretKey(String secretKey) { + configuration.setSecretKey(secretKey); + } + + public String getRegion() { + return configuration.getRegion(); + } + + /** + * The region in which MQ client needs to work + */ + public void setRegion(String region) { + configuration.setRegion(region); + } + +} diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMComponentVerifierExtension.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMComponentVerifierExtension.java new file mode 100644 index 0000000..048217f --- /dev/null +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMComponentVerifierExtension.java @@ -0,0 +1,87 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +import java.util.Map; + +import com.amazonaws.SdkClientException; +import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.regions.Regions; +import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; +import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; + +import org.apache.camel.component.extension.verifier.DefaultComponentVerifierExtension; +import org.apache.camel.component.extension.verifier.ResultBuilder; +import org.apache.camel.component.extension.verifier.ResultErrorBuilder; +import org.apache.camel.component.extension.verifier.ResultErrorHelper; + +public class IAMComponentVerifierExtension extends DefaultComponentVerifierExtension { + + public IAMComponentVerifierExtension() { + this("aws-iam"); + } + + public IAMComponentVerifierExtension(String scheme) { + super(scheme); + } + + // ********************************* + // Parameters validation + // ********************************* + + @Override + protected Result verifyParameters(Map<String, Object> parameters) { + + ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS).error(ResultErrorHelper.requiresOption("accessKey", parameters)) + .error(ResultErrorHelper.requiresOption("secretKey", parameters)).error(ResultErrorHelper.requiresOption("region", parameters)); + + // Validate using the catalog + + super.verifyParametersAgainstCatalog(builder, parameters); + + return builder.build(); + } + + // ********************************* + // Connectivity validation + // ********************************* + + @Override + protected Result verifyConnectivity(Map<String, Object> parameters) { + ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.CONNECTIVITY); + + try { + IAMConfiguration configuration = setProperties(new IAMConfiguration(), parameters); + AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey()); + AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); + AmazonIdentityManagement client = AmazonIdentityManagementClientBuilder.standard().withCredentials(credentialsProvider).withRegion(Regions.valueOf(configuration.getRegion())).build(); + client.listAccessKeys(); + } catch (SdkClientException e) { + ResultErrorBuilder errorBuilder = ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION, e.getMessage()) + .detail("aws_iam_exception_message", e.getMessage()).detail(VerificationError.ExceptionAttribute.EXCEPTION_CLASS, e.getClass().getName()) + .detail(VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE, e); + + builder.error(errorBuilder.build()); + } catch (Exception e) { + builder.error(ResultErrorBuilder.withException(e).build()); + } + return builder.build(); + } +} diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMConfiguration.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMConfiguration.java new file mode 100644 index 0000000..82e97b7 --- /dev/null +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMConfiguration.java @@ -0,0 +1,139 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; +import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClient; +import com.amazonaws.services.kms.AWSKMS; + +import org.apache.camel.RuntimeCamelException; +import org.apache.camel.spi.Metadata; +import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriParams; +import org.apache.camel.spi.UriPath; + +@UriParams +public class IAMConfiguration implements Cloneable { + + @UriPath(description = "Logical name") + @Metadata(required = "true") + private String label; + @UriParam(label = "producer") + private AmazonIdentityManagementClient iamClient; + @UriParam(label = "producer", secret = true) + private String accessKey; + @UriParam(label = "producer", secret = true) + private String secretKey; + @UriParam(label = "producer") + @Metadata(required = "true") + private IAMOperations operation; + @UriParam(label = "producer") + private String proxyHost; + @UriParam(label = "producer") + private Integer proxyPort; + @UriParam + private String region; + + public AmazonIdentityManagementClient getIamClient() { + return iamClient; + } + + /** + * To use a existing configured AWS IAM as client + */ + public void setIamClient(AmazonIdentityManagementClient iamClient) { + this.iamClient = iamClient; + } + + public String getAccessKey() { + return accessKey; + } + + /** + * Amazon AWS Access Key + */ + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + /** + * Amazon AWS Secret Key + */ + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public IAMOperations getOperation() { + return operation; + } + + /** + * The operation to perform + */ + public void setOperation(IAMOperations operation) { + this.operation = operation; + } + + public String getProxyHost() { + return proxyHost; + } + + /** + * To define a proxy host when instantiating the KMS client + */ + public void setProxyHost(String proxyHost) { + this.proxyHost = proxyHost; + } + + public Integer getProxyPort() { + return proxyPort; + } + + /** + * To define a proxy port when instantiating the KMS client + */ + public void setProxyPort(Integer proxyPort) { + this.proxyPort = proxyPort; + } + + public String getRegion() { + return region; + } + + /** + * The region in which KMS client needs to work + */ + public void setRegion(String region) { + this.region = region; + } + + // ************************************************* + // + // ************************************************* + + public IAMConfiguration copy() { + try { + return (IAMConfiguration)super.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeCamelException(e); + } + } +} diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMConstants.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMConstants.java new file mode 100644 index 0000000..b8d9f5f --- /dev/null +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMConstants.java @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +/** + * Constants used in Camel AWS IAM module + * + */ +public interface IAMConstants { + String OPERATION = "CamelAwsKMSOperation"; + String LIMIT = "CamelAwsKMSLimit"; + String DESCRIPTION = "CamelAwsKMSDescription"; + String KEY_ID = "CamelAwsKMSKeyId"; + String PENDING_WINDOW_IN_DAYS = "CamelAwsKMSPendingWindowInDays"; +} diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMEndpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMEndpoint.java new file mode 100644 index 0000000..c528275 --- /dev/null +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMEndpoint.java @@ -0,0 +1,122 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +import com.amazonaws.ClientConfiguration; +import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; +import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClient; +import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; + +import org.apache.camel.Component; +import org.apache.camel.Consumer; +import org.apache.camel.Processor; +import org.apache.camel.Producer; +import org.apache.camel.impl.ScheduledPollEndpoint; +import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriParam; +import org.apache.camel.util.ObjectHelper; + +/** + * The aws-iam is used for managing Amazon IAM + */ +@UriEndpoint(firstVersion = "2.23.0", scheme = "aws-iam", title = "AWS IAM", syntax = "aws-iam:label", producerOnly = true, label = "cloud,management") +public class IAMEndpoint extends ScheduledPollEndpoint { + + private AmazonIdentityManagement iamClient; + + @UriParam + private IAMConfiguration configuration; + + public IAMEndpoint(String uri, Component component, IAMConfiguration configuration) { + super(uri, component); + this.configuration = configuration; + } + + public Consumer createConsumer(Processor processor) throws Exception { + throw new UnsupportedOperationException("You cannot receive messages from this endpoint"); + } + + public Producer createProducer() throws Exception { + return new IAMProducer(this); + } + + public boolean isSingleton() { + return true; + } + + @Override + public void doStart() throws Exception { + super.doStart(); + + iamClient = configuration.getIamClient() != null ? configuration.getIamClient() : createKMSClient(); + } + + @Override + public void doStop() throws Exception { + if (ObjectHelper.isEmpty(configuration.getIamClient())) { + if (iamClient != null) { + iamClient.shutdown(); + } + } + super.doStop(); + } + + public IAMConfiguration getConfiguration() { + return configuration; + } + + public AmazonIdentityManagement getIamClient() { + return iamClient; + } + + AmazonIdentityManagement createKMSClient() { + AmazonIdentityManagement client = null; + ClientConfiguration clientConfiguration = null; + AmazonIdentityManagementClientBuilder clientBuilder = null; + boolean isClientConfigFound = false; + if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) { + clientConfiguration = new ClientConfiguration(); + clientConfiguration.setProxyHost(configuration.getProxyHost()); + clientConfiguration.setProxyPort(configuration.getProxyPort()); + isClientConfigFound = true; + } + if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) { + AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey()); + AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); + if (isClientConfigFound) { + clientBuilder = AmazonIdentityManagementClientBuilder.standard().withClientConfiguration(clientConfiguration).withCredentials(credentialsProvider); + } else { + clientBuilder = AmazonIdentityManagementClientBuilder.standard().withCredentials(credentialsProvider); + } + } else { + if (isClientConfigFound) { + clientBuilder = AmazonIdentityManagementClientBuilder.standard(); + } else { + clientBuilder = AmazonIdentityManagementClientBuilder.standard().withClientConfiguration(clientConfiguration); + } + } + if (ObjectHelper.isNotEmpty(configuration.getRegion())) { + clientBuilder = clientBuilder.withRegion(configuration.getRegion()); + } + client = clientBuilder.build(); + return client; + } +} diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMOperations.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMOperations.java new file mode 100644 index 0000000..5327d5b --- /dev/null +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMOperations.java @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +public enum IAMOperations { + + listAccessKeys +} diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMProducer.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMProducer.java new file mode 100644 index 0000000..04df46a --- /dev/null +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMProducer.java @@ -0,0 +1,93 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +import com.amazonaws.AmazonServiceException; +import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; +import com.amazonaws.services.identitymanagement.model.ListAccessKeysResult; + +import org.apache.camel.Endpoint; +import org.apache.camel.Exchange; +import org.apache.camel.Message; +import org.apache.camel.impl.DefaultProducer; +import org.apache.camel.util.URISupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.apache.camel.component.aws.common.AwsExchangeUtil.getMessageForResponse; + +/** + * A Producer which sends messages to the Amazon IAM Service + * <a href="http://aws.amazon.com/iam/">AWS IAM</a> + */ +public class IAMProducer extends DefaultProducer { + + private static final Logger LOG = LoggerFactory.getLogger(IAMProducer.class); + + private transient String iamProducerToString; + + public IAMProducer(Endpoint endpoint) { + super(endpoint); + } + + public void process(Exchange exchange) throws Exception { + switch (determineOperation(exchange)) { + case listAccessKeys: + listAccessKeys(getEndpoint().getIamClient(), exchange); + break; + default: + throw new IllegalArgumentException("Unsupported operation"); + } + } + + private IAMOperations determineOperation(Exchange exchange) { + IAMOperations operation = exchange.getIn().getHeader(IAMConstants.OPERATION, IAMOperations.class); + if (operation == null) { + operation = getConfiguration().getOperation(); + } + return operation; + } + + protected IAMConfiguration getConfiguration() { + return getEndpoint().getConfiguration(); + } + + @Override + public String toString() { + if (iamProducerToString == null) { + iamProducerToString = "IAMProducer[" + URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]"; + } + return iamProducerToString; + } + + @Override + public IAMEndpoint getEndpoint() { + return (IAMEndpoint)super.getEndpoint(); + } + + private void listAccessKeys(AmazonIdentityManagement iamClient, Exchange exchange) { + ListAccessKeysResult result; + try { + result = iamClient.listAccessKeys(); + } catch (AmazonServiceException ase) { + LOG.trace("List Access Keys command returned the error code {}", ase.getErrorCode()); + throw ase; + } + Message message = getMessageForResponse(exchange); + message.setBody(result); + } +} \ No newline at end of file diff --git a/components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/aws-iam b/components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/aws-iam new file mode 100644 index 0000000..ab88eb6 --- /dev/null +++ b/components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/aws-iam @@ -0,0 +1,18 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License 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. +## --------------------------------------------------------------------------- + +class=org.apache.camel.component.aws.iam.IAMComponent diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/AmazonIAMClientMock.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/AmazonIAMClientMock.java new file mode 100644 index 0000000..4354d5c --- /dev/null +++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/AmazonIAMClientMock.java @@ -0,0 +1,833 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; + +import com.amazonaws.AmazonWebServiceRequest; +import com.amazonaws.ResponseMetadata; +import com.amazonaws.regions.Region; +import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClient; +import com.amazonaws.services.identitymanagement.model.*; +import com.amazonaws.services.identitymanagement.waiters.AmazonIdentityManagementWaiters; + + +public class AmazonIAMClientMock extends AmazonIdentityManagementClient { + + @Override + public void setEndpoint(String endpoint) { + } + + @Override + public void setRegion(Region region) { + } + + @Override + public AddClientIDToOpenIDConnectProviderResult addClientIDToOpenIDConnectProvider( + AddClientIDToOpenIDConnectProviderRequest addClientIDToOpenIDConnectProviderRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public AddRoleToInstanceProfileResult addRoleToInstanceProfile( + AddRoleToInstanceProfileRequest addRoleToInstanceProfileRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public AddUserToGroupResult addUserToGroup(AddUserToGroupRequest addUserToGroupRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public AttachGroupPolicyResult attachGroupPolicy(AttachGroupPolicyRequest attachGroupPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public AttachRolePolicyResult attachRolePolicy(AttachRolePolicyRequest attachRolePolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public AttachUserPolicyResult attachUserPolicy(AttachUserPolicyRequest attachUserPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ChangePasswordResult changePassword(ChangePasswordRequest changePasswordRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateAccessKeyResult createAccessKey(CreateAccessKeyRequest createAccessKeyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateAccessKeyResult createAccessKey() { + throw new UnsupportedOperationException(); + } + + @Override + public CreateAccountAliasResult createAccountAlias(CreateAccountAliasRequest createAccountAliasRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateGroupResult createGroup(CreateGroupRequest createGroupRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateInstanceProfileResult createInstanceProfile( + CreateInstanceProfileRequest createInstanceProfileRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateLoginProfileResult createLoginProfile(CreateLoginProfileRequest createLoginProfileRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateOpenIDConnectProviderResult createOpenIDConnectProvider( + CreateOpenIDConnectProviderRequest createOpenIDConnectProviderRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreatePolicyResult createPolicy(CreatePolicyRequest createPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreatePolicyVersionResult createPolicyVersion(CreatePolicyVersionRequest createPolicyVersionRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateRoleResult createRole(CreateRoleRequest createRoleRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateSAMLProviderResult createSAMLProvider(CreateSAMLProviderRequest createSAMLProviderRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateServiceLinkedRoleResult createServiceLinkedRole( + CreateServiceLinkedRoleRequest createServiceLinkedRoleRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateServiceSpecificCredentialResult createServiceSpecificCredential( + CreateServiceSpecificCredentialRequest createServiceSpecificCredentialRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateUserResult createUser(CreateUserRequest createUserRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public CreateVirtualMFADeviceResult createVirtualMFADevice( + CreateVirtualMFADeviceRequest createVirtualMFADeviceRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeactivateMFADeviceResult deactivateMFADevice(DeactivateMFADeviceRequest deactivateMFADeviceRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteAccessKeyResult deleteAccessKey(DeleteAccessKeyRequest deleteAccessKeyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteAccountAliasResult deleteAccountAlias(DeleteAccountAliasRequest deleteAccountAliasRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteAccountPasswordPolicyResult deleteAccountPasswordPolicy( + DeleteAccountPasswordPolicyRequest deleteAccountPasswordPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteAccountPasswordPolicyResult deleteAccountPasswordPolicy() { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteGroupResult deleteGroup(DeleteGroupRequest deleteGroupRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteGroupPolicyResult deleteGroupPolicy(DeleteGroupPolicyRequest deleteGroupPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteInstanceProfileResult deleteInstanceProfile( + DeleteInstanceProfileRequest deleteInstanceProfileRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteLoginProfileResult deleteLoginProfile(DeleteLoginProfileRequest deleteLoginProfileRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteOpenIDConnectProviderResult deleteOpenIDConnectProvider( + DeleteOpenIDConnectProviderRequest deleteOpenIDConnectProviderRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeletePolicyResult deletePolicy(DeletePolicyRequest deletePolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeletePolicyVersionResult deletePolicyVersion(DeletePolicyVersionRequest deletePolicyVersionRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteRoleResult deleteRole(DeleteRoleRequest deleteRoleRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteRolePolicyResult deleteRolePolicy(DeleteRolePolicyRequest deleteRolePolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteSAMLProviderResult deleteSAMLProvider(DeleteSAMLProviderRequest deleteSAMLProviderRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteSSHPublicKeyResult deleteSSHPublicKey(DeleteSSHPublicKeyRequest deleteSSHPublicKeyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteServerCertificateResult deleteServerCertificate( + DeleteServerCertificateRequest deleteServerCertificateRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteServiceLinkedRoleResult deleteServiceLinkedRole( + DeleteServiceLinkedRoleRequest deleteServiceLinkedRoleRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteServiceSpecificCredentialResult deleteServiceSpecificCredential( + DeleteServiceSpecificCredentialRequest deleteServiceSpecificCredentialRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteSigningCertificateResult deleteSigningCertificate( + DeleteSigningCertificateRequest deleteSigningCertificateRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteUserResult deleteUser(DeleteUserRequest deleteUserRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteUserPolicyResult deleteUserPolicy(DeleteUserPolicyRequest deleteUserPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteVirtualMFADeviceResult deleteVirtualMFADevice( + DeleteVirtualMFADeviceRequest deleteVirtualMFADeviceRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DetachGroupPolicyResult detachGroupPolicy(DetachGroupPolicyRequest detachGroupPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DetachRolePolicyResult detachRolePolicy(DetachRolePolicyRequest detachRolePolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public DetachUserPolicyResult detachUserPolicy(DetachUserPolicyRequest detachUserPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public EnableMFADeviceResult enableMFADevice(EnableMFADeviceRequest enableMFADeviceRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GenerateCredentialReportResult generateCredentialReport( + GenerateCredentialReportRequest generateCredentialReportRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GenerateCredentialReportResult generateCredentialReport() { + throw new UnsupportedOperationException(); + } + + @Override + public GetAccessKeyLastUsedResult getAccessKeyLastUsed(GetAccessKeyLastUsedRequest getAccessKeyLastUsedRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetAccountAuthorizationDetailsResult getAccountAuthorizationDetails( + GetAccountAuthorizationDetailsRequest getAccountAuthorizationDetailsRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetAccountAuthorizationDetailsResult getAccountAuthorizationDetails() { + throw new UnsupportedOperationException(); + } + + @Override + public GetAccountPasswordPolicyResult getAccountPasswordPolicy( + GetAccountPasswordPolicyRequest getAccountPasswordPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetAccountPasswordPolicyResult getAccountPasswordPolicy() { + throw new UnsupportedOperationException(); + } + + @Override + public GetAccountSummaryResult getAccountSummary(GetAccountSummaryRequest getAccountSummaryRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetAccountSummaryResult getAccountSummary() { + throw new UnsupportedOperationException(); + } + + @Override + public GetContextKeysForCustomPolicyResult getContextKeysForCustomPolicy( + GetContextKeysForCustomPolicyRequest getContextKeysForCustomPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetContextKeysForPrincipalPolicyResult getContextKeysForPrincipalPolicy( + GetContextKeysForPrincipalPolicyRequest getContextKeysForPrincipalPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetCredentialReportResult getCredentialReport(GetCredentialReportRequest getCredentialReportRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetCredentialReportResult getCredentialReport() { + throw new UnsupportedOperationException(); + } + + @Override + public GetGroupResult getGroup(GetGroupRequest getGroupRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetGroupPolicyResult getGroupPolicy(GetGroupPolicyRequest getGroupPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetInstanceProfileResult getInstanceProfile(GetInstanceProfileRequest getInstanceProfileRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetLoginProfileResult getLoginProfile(GetLoginProfileRequest getLoginProfileRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetOpenIDConnectProviderResult getOpenIDConnectProvider( + GetOpenIDConnectProviderRequest getOpenIDConnectProviderRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetPolicyResult getPolicy(GetPolicyRequest getPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetPolicyVersionResult getPolicyVersion(GetPolicyVersionRequest getPolicyVersionRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetRoleResult getRole(GetRoleRequest getRoleRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetRolePolicyResult getRolePolicy(GetRolePolicyRequest getRolePolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetSAMLProviderResult getSAMLProvider(GetSAMLProviderRequest getSAMLProviderRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetSSHPublicKeyResult getSSHPublicKey(GetSSHPublicKeyRequest getSSHPublicKeyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetServerCertificateResult getServerCertificate(GetServerCertificateRequest getServerCertificateRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetServiceLinkedRoleDeletionStatusResult getServiceLinkedRoleDeletionStatus( + GetServiceLinkedRoleDeletionStatusRequest getServiceLinkedRoleDeletionStatusRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetUserResult getUser(GetUserRequest getUserRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public GetUserResult getUser() { + throw new UnsupportedOperationException(); + } + + @Override + public GetUserPolicyResult getUserPolicy(GetUserPolicyRequest getUserPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListAccessKeysResult listAccessKeys(ListAccessKeysRequest listAccessKeysRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListAccessKeysResult listAccessKeys() { + ListAccessKeysResult result = new ListAccessKeysResult(); + Collection<AccessKeyMetadata> accessKeyMetadata = new ArrayList<AccessKeyMetadata>(); + AccessKeyMetadata meta = new AccessKeyMetadata(); + meta.setAccessKeyId("1"); + meta.setCreateDate(new Date()); + meta.setStatus(StatusType.Active); + meta.setUserName("test"); + accessKeyMetadata.add(meta); + result.setAccessKeyMetadata(accessKeyMetadata); + return result; + } + + @Override + public ListAccountAliasesResult listAccountAliases(ListAccountAliasesRequest listAccountAliasesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListAccountAliasesResult listAccountAliases() { + throw new UnsupportedOperationException(); + } + + @Override + public ListAttachedGroupPoliciesResult listAttachedGroupPolicies( + ListAttachedGroupPoliciesRequest listAttachedGroupPoliciesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListAttachedRolePoliciesResult listAttachedRolePolicies( + ListAttachedRolePoliciesRequest listAttachedRolePoliciesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListAttachedUserPoliciesResult listAttachedUserPolicies( + ListAttachedUserPoliciesRequest listAttachedUserPoliciesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListEntitiesForPolicyResult listEntitiesForPolicy( + ListEntitiesForPolicyRequest listEntitiesForPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListGroupPoliciesResult listGroupPolicies(ListGroupPoliciesRequest listGroupPoliciesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListGroupsResult listGroups(ListGroupsRequest listGroupsRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListGroupsResult listGroups() { + throw new UnsupportedOperationException(); + } + + @Override + public ListGroupsForUserResult listGroupsForUser(ListGroupsForUserRequest listGroupsForUserRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListInstanceProfilesResult listInstanceProfiles(ListInstanceProfilesRequest listInstanceProfilesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListInstanceProfilesResult listInstanceProfiles() { + throw new UnsupportedOperationException(); + } + + @Override + public ListInstanceProfilesForRoleResult listInstanceProfilesForRole( + ListInstanceProfilesForRoleRequest listInstanceProfilesForRoleRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListMFADevicesResult listMFADevices(ListMFADevicesRequest listMFADevicesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListMFADevicesResult listMFADevices() { + throw new UnsupportedOperationException(); + } + + @Override + public ListOpenIDConnectProvidersResult listOpenIDConnectProviders( + ListOpenIDConnectProvidersRequest listOpenIDConnectProvidersRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListOpenIDConnectProvidersResult listOpenIDConnectProviders() { + throw new UnsupportedOperationException(); + } + + @Override + public ListPoliciesResult listPolicies(ListPoliciesRequest listPoliciesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListPoliciesResult listPolicies() { + throw new UnsupportedOperationException(); + } + + @Override + public ListPolicyVersionsResult listPolicyVersions(ListPolicyVersionsRequest listPolicyVersionsRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListRolePoliciesResult listRolePolicies(ListRolePoliciesRequest listRolePoliciesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListRolesResult listRoles(ListRolesRequest listRolesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListRolesResult listRoles() { + throw new UnsupportedOperationException(); + } + + @Override + public ListSAMLProvidersResult listSAMLProviders(ListSAMLProvidersRequest listSAMLProvidersRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListSAMLProvidersResult listSAMLProviders() { + throw new UnsupportedOperationException(); + } + + @Override + public ListSSHPublicKeysResult listSSHPublicKeys(ListSSHPublicKeysRequest listSSHPublicKeysRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListSSHPublicKeysResult listSSHPublicKeys() { + throw new UnsupportedOperationException(); + } + + @Override + public ListServerCertificatesResult listServerCertificates( + ListServerCertificatesRequest listServerCertificatesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListServerCertificatesResult listServerCertificates() { + throw new UnsupportedOperationException(); + } + + @Override + public ListServiceSpecificCredentialsResult listServiceSpecificCredentials( + ListServiceSpecificCredentialsRequest listServiceSpecificCredentialsRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListSigningCertificatesResult listSigningCertificates( + ListSigningCertificatesRequest listSigningCertificatesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListSigningCertificatesResult listSigningCertificates() { + throw new UnsupportedOperationException(); + } + + @Override + public ListUserPoliciesResult listUserPolicies(ListUserPoliciesRequest listUserPoliciesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListUsersResult listUsers(ListUsersRequest listUsersRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListUsersResult listUsers() { + throw new UnsupportedOperationException(); + } + + @Override + public ListVirtualMFADevicesResult listVirtualMFADevices( + ListVirtualMFADevicesRequest listVirtualMFADevicesRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ListVirtualMFADevicesResult listVirtualMFADevices() { + throw new UnsupportedOperationException(); + } + + @Override + public PutGroupPolicyResult putGroupPolicy(PutGroupPolicyRequest putGroupPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public PutRolePolicyResult putRolePolicy(PutRolePolicyRequest putRolePolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public PutUserPolicyResult putUserPolicy(PutUserPolicyRequest putUserPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public RemoveClientIDFromOpenIDConnectProviderResult removeClientIDFromOpenIDConnectProvider( + RemoveClientIDFromOpenIDConnectProviderRequest removeClientIDFromOpenIDConnectProviderRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public RemoveRoleFromInstanceProfileResult removeRoleFromInstanceProfile( + RemoveRoleFromInstanceProfileRequest removeRoleFromInstanceProfileRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public RemoveUserFromGroupResult removeUserFromGroup(RemoveUserFromGroupRequest removeUserFromGroupRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ResetServiceSpecificCredentialResult resetServiceSpecificCredential( + ResetServiceSpecificCredentialRequest resetServiceSpecificCredentialRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public ResyncMFADeviceResult resyncMFADevice(ResyncMFADeviceRequest resyncMFADeviceRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public SetDefaultPolicyVersionResult setDefaultPolicyVersion( + SetDefaultPolicyVersionRequest setDefaultPolicyVersionRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public SimulateCustomPolicyResult simulateCustomPolicy(SimulateCustomPolicyRequest simulateCustomPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public SimulatePrincipalPolicyResult simulatePrincipalPolicy( + SimulatePrincipalPolicyRequest simulatePrincipalPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateAccessKeyResult updateAccessKey(UpdateAccessKeyRequest updateAccessKeyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateAccountPasswordPolicyResult updateAccountPasswordPolicy( + UpdateAccountPasswordPolicyRequest updateAccountPasswordPolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateAssumeRolePolicyResult updateAssumeRolePolicy( + UpdateAssumeRolePolicyRequest updateAssumeRolePolicyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateGroupResult updateGroup(UpdateGroupRequest updateGroupRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateLoginProfileResult updateLoginProfile(UpdateLoginProfileRequest updateLoginProfileRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateOpenIDConnectProviderThumbprintResult updateOpenIDConnectProviderThumbprint( + UpdateOpenIDConnectProviderThumbprintRequest updateOpenIDConnectProviderThumbprintRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateRoleDescriptionResult updateRoleDescription( + UpdateRoleDescriptionRequest updateRoleDescriptionRequest) { + throw new UnsupportedOperationException(); + } + + + + @Override + public UpdateSAMLProviderResult updateSAMLProvider(UpdateSAMLProviderRequest updateSAMLProviderRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateSSHPublicKeyResult updateSSHPublicKey(UpdateSSHPublicKeyRequest updateSSHPublicKeyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateServerCertificateResult updateServerCertificate( + UpdateServerCertificateRequest updateServerCertificateRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateServiceSpecificCredentialResult updateServiceSpecificCredential( + UpdateServiceSpecificCredentialRequest updateServiceSpecificCredentialRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateSigningCertificateResult updateSigningCertificate( + UpdateSigningCertificateRequest updateSigningCertificateRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UpdateUserResult updateUser(UpdateUserRequest updateUserRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UploadSSHPublicKeyResult uploadSSHPublicKey(UploadSSHPublicKeyRequest uploadSSHPublicKeyRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UploadServerCertificateResult uploadServerCertificate( + UploadServerCertificateRequest uploadServerCertificateRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public UploadSigningCertificateResult uploadSigningCertificate( + UploadSigningCertificateRequest uploadSigningCertificateRequest) { + throw new UnsupportedOperationException(); + } + + @Override + public void shutdown() { + throw new UnsupportedOperationException(); + + } + + @Override + public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) { + throw new UnsupportedOperationException(); + } + + @Override + public AmazonIdentityManagementWaiters waiters() { + throw new UnsupportedOperationException(); + } +} diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMComponentConfigurationTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMComponentConfigurationTest.java new file mode 100644 index 0000000..1c7e791 --- /dev/null +++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMComponentConfigurationTest.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +import com.amazonaws.regions.Regions; + +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; + +public class IAMComponentConfigurationTest extends CamelTestSupport { + + + @Test + public void createEndpointWithComponentElements() throws Exception { + IAMComponent component = new IAMComponent(context); + component.setAccessKey("XXX"); + component.setSecretKey("YYY"); + IAMEndpoint endpoint = (IAMEndpoint)component.createEndpoint("aws-iam://label"); + + assertEquals("XXX", endpoint.getConfiguration().getAccessKey()); + assertEquals("YYY", endpoint.getConfiguration().getSecretKey()); + } + + @Test + public void createEndpointWithComponentAndEndpointElements() throws Exception { + IAMComponent component = new IAMComponent(context); + component.setAccessKey("XXX"); + component.setSecretKey("YYY"); + component.setRegion(Regions.US_WEST_1.toString()); + IAMEndpoint endpoint = (IAMEndpoint)component.createEndpoint("aws-iam://label?accessKey=xxxxxx&secretKey=yyyyy®ion=US_EAST_1"); + + assertEquals("xxxxxx", endpoint.getConfiguration().getAccessKey()); + assertEquals("yyyyy", endpoint.getConfiguration().getSecretKey()); + assertEquals("US_EAST_1", endpoint.getConfiguration().getRegion()); + } + +} diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMComponentVerifierExtensionTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMComponentVerifierExtensionTest.java new file mode 100644 index 0000000..4681483 --- /dev/null +++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMComponentVerifierExtensionTest.java @@ -0,0 +1,73 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.camel.Component; +import org.apache.camel.component.extension.ComponentVerifierExtension; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Assert; +import org.junit.Test; + +public class IAMComponentVerifierExtensionTest extends CamelTestSupport { + + // ************************************************* + // Tests (parameters) + // ************************************************* + @Override + public boolean isUseRouteBuilder() { + return false; + } + + @Test + public void testParameters() throws Exception { + Component component = context().getComponent("aws-iam"); + + ComponentVerifierExtension verifier = component.getExtension(ComponentVerifierExtension.class).orElseThrow(IllegalStateException::new); + + Map<String, Object> parameters = new HashMap<>(); + parameters.put("secretKey", "l"); + parameters.put("accessKey", "k"); + parameters.put("region", "l"); + parameters.put("label", "test"); + parameters.put("operation", IAMOperations.listAccessKeys); + + ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters); + + Assert.assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus()); + } + + @Test + public void testConnectivity() throws Exception { + Component component = context().getComponent("aws-iam"); + ComponentVerifierExtension verifier = component.getExtension(ComponentVerifierExtension.class).orElseThrow(IllegalStateException::new); + + Map<String, Object> parameters = new HashMap<>(); + parameters.put("secretKey", "l"); + parameters.put("accessKey", "k"); + parameters.put("region", "US_EAST_1"); + parameters.put("label", "test"); + parameters.put("operation", IAMOperations.listAccessKeys); + + ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); + + Assert.assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); + } + +} diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerSpringTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerSpringTest.java new file mode 100644 index 0000000..f44dd88 --- /dev/null +++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerSpringTest.java @@ -0,0 +1,57 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +import org.apache.camel.EndpointInject; +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.spring.CamelSpringTestSupport; +import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import com.amazonaws.services.identitymanagement.model.ListAccessKeysResult; + +public class IAMProducerSpringTest extends CamelSpringTestSupport { + + @EndpointInject(uri = "mock:result") + private MockEndpoint mock; + + @Test + public void mqListBrokersTest() throws Exception { + + mock.expectedMessageCount(1); + Exchange exchange = template.request("direct:listKeys", new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setHeader(IAMConstants.OPERATION, IAMOperations.listAccessKeys); + } + }); + + assertMockEndpointsSatisfied(); + + ListAccessKeysResult resultGet = (ListAccessKeysResult) exchange.getIn().getBody(); + assertEquals(1, resultGet.getAccessKeyMetadata().size()); + assertEquals("1", resultGet.getAccessKeyMetadata().get(0).getAccessKeyId()); + } + + @Override + protected ClassPathXmlApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext( + "org/apache/camel/component/aws/iam/IAMComponentSpringTest-context.xml"); + } +} \ No newline at end of file diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerTest.java new file mode 100644 index 0000000..63089a2 --- /dev/null +++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerTest.java @@ -0,0 +1,74 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam; + +import org.apache.camel.EndpointInject; +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.impl.JndiRegistry; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; + +import com.amazonaws.services.identitymanagement.model.ListAccessKeysResult; + +public class IAMProducerTest extends CamelTestSupport { + + @EndpointInject(uri = "mock:result") + private MockEndpoint mock; + + @Test + public void iamListKeysTest() throws Exception { + + mock.expectedMessageCount(1); + Exchange exchange = template.request("direct:listKeys", new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setHeader(IAMConstants.OPERATION, IAMOperations.listAccessKeys); + } + }); + + assertMockEndpointsSatisfied(); + + ListAccessKeysResult resultGet = (ListAccessKeysResult) exchange.getIn().getBody(); + assertEquals(1, resultGet.getAccessKeyMetadata().size()); + assertEquals("1", resultGet.getAccessKeyMetadata().get(0).getAccessKeyId()); + } + + @Override + protected JndiRegistry createRegistry() throws Exception { + JndiRegistry registry = super.createRegistry(); + + AmazonIAMClientMock clientMock = new AmazonIAMClientMock(); + + registry.bind("amazonIAMClient", clientMock); + + return registry; + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:listKeys").to("aws-iam://test?iamClient=#amazonIAMClient&operation=listAccessKeys") + .to("mock:result"); + } + }; + } +} \ No newline at end of file diff --git a/components/camel-aws/src/test/resources/org/apache/camel/component/aws/iam/IAMComponentSpringTest-context.xml b/components/camel-aws/src/test/resources/org/apache/camel/component/aws/iam/IAMComponentSpringTest-context.xml new file mode 100644 index 0000000..4c81bf9 --- /dev/null +++ b/components/camel-aws/src/test/resources/org/apache/camel/component/aws/iam/IAMComponentSpringTest-context.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License 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. + +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:listKeys"/> + <to uri="aws-iam://Test?iamClient=#amazonIAMClient&operation=listAccessKeys"/> + <to uri="mock:result"/> + </route> + </camelContext> + + <bean id="amazonIAMClient" class="org.apache.camel.component.aws.iam.AmazonIAMClientMock"/> +</beans> \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/iam/springboot/IAMComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/iam/springboot/IAMComponentAutoConfiguration.java new file mode 100644 index 0000000..5c40a2e --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/iam/springboot/IAMComponentAutoConfiguration.java @@ -0,0 +1,128 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.aws.iam.IAMComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.util.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class, + IAMComponentAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class, + IAMComponentConfiguration.class}) +public class IAMComponentAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(IAMComponentAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private IAMComponentConfiguration configuration; + @Autowired(required = false) + private List<ComponentCustomizer<IAMComponent>> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.component", "camel.component.aws-iam"); + } + } + + @Lazy + @Bean(name = "aws-iam-component") + @ConditionalOnMissingBean(IAMComponent.class) + public IAMComponent configureIAMComponent() throws Exception { + IAMComponent component = new IAMComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + CamelPropertiesHelper.setCamelProperties(camelContext, + nestedProperty, nestedParameters, false); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + CamelPropertiesHelper.setCamelProperties(camelContext, component, + parameters, false); + if (ObjectHelper.isNotEmpty(customizers)) { + for (ComponentCustomizer<IAMComponent> customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-iam.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-iam.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } + } + } + return component; + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/iam/springboot/IAMComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/iam/springboot/IAMComponentConfiguration.java new file mode 100644 index 0000000..6e2eea6 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/iam/springboot/IAMComponentConfiguration.java @@ -0,0 +1,193 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.camel.component.aws.iam.springboot; + +import javax.annotation.Generated; +import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClient; +import org.apache.camel.component.aws.iam.IAMOperations; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The aws-iam is used for managing Amazon IAM + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.aws-iam") +public class IAMComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the aws-iam component. This is + * enabled by default. + */ + private Boolean enabled; + /** + * The AWS MQ default configuration + */ + private IAMConfigurationNestedConfiguration configuration; + /** + * Amazon AWS Access Key + */ + private String accessKey; + /** + * Amazon AWS Secret Key + */ + private String secretKey; + /** + * The region in which MQ client needs to work + */ + private String region; + /** + * Whether the component should resolve property placeholders on itself when + * starting. Only properties which are of String type can use property + * placeholders. + */ + private Boolean resolvePropertyPlaceholders = true; + + public IAMConfigurationNestedConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration( + IAMConfigurationNestedConfiguration configuration) { + this.configuration = configuration; + } + + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public Boolean getResolvePropertyPlaceholders() { + return resolvePropertyPlaceholders; + } + + public void setResolvePropertyPlaceholders( + Boolean resolvePropertyPlaceholders) { + this.resolvePropertyPlaceholders = resolvePropertyPlaceholders; + } + + public static class IAMConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.aws.iam.IAMConfiguration.class; + /** + * To use a existing configured AWS IAM as client + */ + private AmazonIdentityManagementClient iamClient; + /** + * Amazon AWS Access Key + */ + private String accessKey; + /** + * Amazon AWS Secret Key + */ + private String secretKey; + /** + * The operation to perform + */ + private IAMOperations operation; + /** + * To define a proxy host when instantiating the KMS client + */ + private String proxyHost; + /** + * To define a proxy port when instantiating the KMS client + */ + private Integer proxyPort; + /** + * The region in which KMS client needs to work + */ + private String region; + + public AmazonIdentityManagementClient getIamClient() { + return iamClient; + } + + public void setIamClient(AmazonIdentityManagementClient iamClient) { + this.iamClient = iamClient; + } + + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public IAMOperations getOperation() { + return operation; + } + + public void setOperation(IAMOperations operation) { + this.operation = operation; + } + + public String getProxyHost() { + return proxyHost; + } + + public void setProxyHost(String proxyHost) { + this.proxyHost = proxyHost; + } + + public Integer getProxyPort() { + return proxyPort; + } + + public void setProxyPort(Integer proxyPort) { + this.proxyPort = proxyPort; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/resources/META-INF/spring.factories index aaa12f1..e2d56a1 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/resources/META-INF/spring.factories +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/resources/META-INF/spring.factories @@ -29,7 +29,9 @@ org.apache.camel.component.aws.ddb.springboot.DdbComponentAutoConfiguration,\ org.apache.camel.component.aws.firehose.springboot.KinesisFirehoseComponentAutoConfiguration,\ org.apache.camel.component.aws.lambda.springboot.LambdaComponentAutoConfiguration,\ org.apache.camel.component.aws.mq.springboot.MQComponentAutoConfiguration,\ -org.apache.camel.component.aws.kms.springboot.KMSComponentAutoConfiguration +org.apache.camel.component.aws.kms.springboot.KMSComponentAutoConfiguration,\ +org.apache.camel.component.aws.iam.springboot.IAMComponentAutoConfiguration +
