List of usage examples for org.apache.commons.lang3.tuple ImmutablePair getLeft
@Override
public L getLeft()
From source file:com.telefonica.iot.cygnus.utils.NGSIUtilsTest.java
/** * [NGSIUtils.getGeometry] -------- When getting a geometry, a CartoDB geometry is obtained when passing * an attribute of type 'geo:json'.//from w w w . j av a 2s . co m */ @Test public void testGetGeometryGeojson() { System.out.println(getTestTraceHead("[Utils.getLocation]") + "-------- When getting a geometry, a CartoDB geometry is obtained when passing an attribute " + "of type 'geo:json'"); String attrMetadataStr = "[]"; String attrValue = "{\"coordinates\": [-3.7167, 40.3833], \"type\": \"Point\"}"; String attrType = "geo:json"; boolean swapCoordinates = false; // irrelevant for this test ImmutablePair<String, Boolean> geometry = NGSIUtils.getGeometry(attrValue, attrType, attrMetadataStr, swapCoordinates); try { assertEquals("ST_GeomFromGeoJSON({\"coordinates\": [-3.7167, 40.3833], \"type\": \"Point\"})", geometry.getLeft()); System.out.println(getTestTraceHead("[Utils.getLocation]") + "- OK - Geometry '" + geometry.getLeft() + "' obtained for an attribute of type '" + attrType + "' and value '" + attrValue + "'"); } catch (AssertionError e) { System.out.println(getTestTraceHead("[Utils.getLocation]") + "- FAIL - Geometry '" + geometry.getLeft() + "' obtained for an attribute of type '" + attrType + "' and value '" + attrValue + "'"); throw e; } // try catch // try catch }
From source file:com.netflix.imfutility.audio.SoundfieldGroupHelper.java
protected String getLanguage(SoundfieldGroupInfo info) { String lang = null;//w w w . j a va2s . c o m for (ImmutablePair<SequenceUUID, Integer> seqInfos : info.getChannelsMap().values()) { SequenceTemplateParameterContext seqContext = contextProvider.getSequenceContext(); ContextInfo contextInfo = new ContextInfoBuilder().setSequenceType(SequenceType.AUDIO) .setSequenceUuid(seqInfos.getLeft()).build(); if (!seqContext.hasSequenceParameter(SequenceContextParameters.LANGUAGE, contextInfo)) { return null; } String nextLang = seqContext.getParameterValue(SequenceContextParameters.LANGUAGE, contextInfo); // all sequences from a soundfield group must have the same language! if (lang != null && !lang.equals(nextLang)) { return null; } lang = nextLang; } return lang; }
From source file:io.cloudslang.content.amazon.actions.volumes.DescribeVolumesAction.java
/** * Describes one or more volumes./*w ww.j av a 2 s .c o m*/ * Note: If you are describing a long list of volumes, you can paginate the output to make the list more manageable. * The maxResults parameter sets the maximum number of results returned in a single page. * If the list of results exceeds your maxResults value, then that number of results is returned along with a * nextToken value that can be passed to a subsequent DescribeVolumes operation to retrieve the remaining results. * * @param endpoint Endpoint to which request will be sent. * Default: "https://ec2.amazonaws.com" * @param identity ID of the secret access key associated with your Amazon AWS or IAM account. * Example: "AKIAIOSFODNN7EXAMPLE" * @param credential Secret access key associated with your Amazon AWS or IAM account. * Example: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" * @param proxyHost Optional - proxy server used to connect to Amazon API. If empty no proxy * will be used. * Default: "" * @param proxyPort Optional - proxy server port. You must either specify values for both * <proxyHost> and <proxyPort> inputs or leave them both empty. * Default: "" * @param proxyUsername Optional - proxy server user name. * Default: "" * @param proxyPassword Optional - proxy server password associated with the <proxyUsername> * input value. * Default: "" * @param headers Optional - string containing the headers to use for the request separated * by new line (CRLF). The header name-value pair will be separated by ":". * Format: Conforming with HTTP standard for headers (RFC 2616) * Examples: "Accept:text/plain" * Default: "" * @param queryParams Optional - string containing query parameters that will be appended to * the URL. The names and the values must not be URL encoded because if * they are encoded then a double encoded will occur. The separator between * name-value pairs is "&" symbol. The query name will be separated from * query value by "=". * Examples: "parameterName1=parameterValue1¶meterName2=parameterValue2" * Default: "" * @param version Version of the web service to made the call against it. * Example: "2016-11-15" * Default: "2016-11-15" * @param delimiter Optional - Delimiter that will be used. * Default: "," * @param filterAttachmentAttachTime Optional - The time stamp when the attachment initiated. * Example: "2016-12-02T10:28:20.000Z" * Default: "" * @param filterAttachmentDeleteOnTermination Optional - Whether the volume is deleted on instance termination. * Valid values: true | false * Default: "" * @param filterAttachmentDevice Optional - The device name that is exposed to the instance. * Example: "/dev/sda1" * Default: "" * @param filterAttachmentInstanceId Optional - The ID of the instance the volume is attached to. * Example: "i-468cisID" * Default: "" * @param filterAttachmentStatus Optional - The attachment state. * Valid values: attaching | attached | detaching | detached * Default: "" * @param filterAvailabilityZone Optional - The Availability Zone in which the volume was created. * Example: "us-east-xx" * Default: "" * @param filterCreateTime Optional - The time stamp when the volume was created. * Default: "" * @param filterEncrypted Optional - The encryption status of the volume. * Valid values: true | false * Default: "" * @param filterSize Optional - The size of the volume, in GiB. * Example: "50" * Default: "" * @param filterSnapshotId Optional - The snapshot from which the volume was created. * Example: "snap-1234567890abcdef0" * Default: "" * @param filterStatus Optional - The status of the volume. * Valid values: creating | available | in-use | deleting | deleted | error * Default: "" * @param filterTag Optional - The key/value combination of a tag assigned to the resource. * Example: "tagKey=tagValue" * Default: "" * @param filterTagKey Optional - The key of a tag assigned to the resource. This filter is * independent of the filterTagValue filter. For example, if you use both * the filter filterTagKey="Purpose" and the filter filterTagValue="X", * you get any resources assigned both the tag key Purpose (regardless of what the tag's value is), * and the tag value X (regardless of what the tag's key is). * Note: If you want to list only resources where Purpose is X, * see the filterTag filter. * Example: "tagKey" * Default: "" * @param filterTagValue Optional - The value of a tag assigned to the resource. * This filter is independent of the filterTagKey filter. * Example: "tagValue" * @param filterVolumeId Optional - The volume ID. * Example: "vol-049df61146c4d7901" * Default: "" * @param filterVolumeType Optional - The Amazon EBS volume type. * Valid values: gp2 | io1 | st1 | sc1 | standard * Default: "" * @param maxResults Optional - The maximum number of results to return in a single call. To retrieve the * remaining results, make another call with the returned NextToken value. This value can * be between 5 and 1000. You cannot specify this parameter and the tag filters in the same call. * Default: "" * @param nextToken Optional - The token to use to retrieve the next page of results. This value is null when * there are no more results to return. * Default: "" * @return A map with strings as keys and strings as values that contains: outcome of the action, returnCode of the * operation, or failure message and the exception if there is one */ @Action(name = "Describe Volumes", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(EXCEPTION) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR) }) public Map<String, String> execute(@Param(value = ENDPOINT) String endpoint, @Param(value = IDENTITY, required = true) String identity, @Param(value = CREDENTIAL, required = true, encrypted = true) String credential, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword, @Param(value = HEADERS) String headers, @Param(value = QUERY_PARAMS) String queryParams, @Param(value = VERSION) String version, @Param(value = DELIMITER) String delimiter, @Param(value = VOLUME_IDS_STRING) String volumeIdsString, @Param(value = FILTER_ATTACHMENT_ATTACH_TIME) String filterAttachmentAttachTime, @Param(value = FILTER_ATTACHMENT_DELETE_ON_TERMINATION) String filterAttachmentDeleteOnTermination, @Param(value = FILTER_ATTACHMENT_DEVICE) String filterAttachmentDevice, @Param(value = FILTER_ATTACHMENT_INSTANCE_ID) String filterAttachmentInstanceId, @Param(value = FILTER_ATTACHMENT_STATUS) String filterAttachmentStatus, @Param(value = FILTER_AVAILABILITY_ZONE) String filterAvailabilityZone, @Param(value = FILTER_CREATE_TIME) String filterCreateTime, @Param(value = FILTER_ENCRYPTED) String filterEncrypted, @Param(value = FILTER_SIZE) String filterSize, @Param(value = FILTER_SNAPSHOT_ID) String filterSnapshotId, @Param(value = FILTER_STATUS) String filterStatus, @Param(value = FILTER_TAG) String filterTag, @Param(value = FILTER_TAG_KEY) String filterTagKey, @Param(value = FILTER_TAG_VALUE) String filterTagValue, @Param(value = FILTER_VOLUME_ID) String filterVolumeId, @Param(value = FILTER_VOLUME_TYPE) String filterVolumeType, @Param(value = MAX_RESULTS) String maxResults, @Param(value = NEXT_TOKEN) String nextToken) { try { version = getDefaultStringInput(version, VOLUMES_DEFAULT_API_VERSION); delimiter = getDefaultStringInput(delimiter, COMMA_DELIMITER); final CommonInputs commonInputs = new CommonInputs.Builder().withEndpoint(endpoint, EC2_API, EMPTY) .withIdentity(identity).withCredential(credential).withProxyHost(proxyHost) .withProxyPort(proxyPort).withProxyUsername(proxyUsername).withProxyPassword(proxyPassword) .withHeaders(headers).withQueryParams(queryParams).withVersion(version).withDelimiter(delimiter) .withAction(DESCRIBE_VOLUMES).withApiService(EC2_API).withRequestUri(EMPTY) .withRequestPayload(EMPTY).withHttpClientMethod(HTTP_CLIENT_METHOD_GET).build(); final VolumeInputs volumeInputs = new VolumeInputs.Builder().withVolumeIdsString(volumeIdsString) .withMaxResults(maxResults).withNextToken(nextToken).build(); final List<ImmutablePair<String, String>> filterPairs = Arrays.asList( of(VolumeFilter.ATTACHMENT_ATTACH_TIME, filterAttachmentAttachTime), of(VolumeFilter.ATTACHMENT_DELETE_ON_TERMINATION, filterAttachmentDeleteOnTermination), of(VolumeFilter.ATTACHMENT_DEVICE, filterAttachmentDevice), of(VolumeFilter.ATTACHMENT_INSTANCE_ID, filterAttachmentInstanceId), of(VolumeFilter.ATTACHMENT_STATUS, filterAttachmentStatus), of(VolumeFilter.AVAILABILITY_ZONE, filterAvailabilityZone), of(VolumeFilter.CREATE_TIME, filterCreateTime), of(VolumeFilter.ENCRYPTED, filterEncrypted), of(VolumeFilter.SIZE, filterSize), of(VolumeFilter.SNAPSHOT_ID, filterSnapshotId), of(VolumeFilter.STATUS, filterStatus), of(VolumeFilter.TAG_KEY, filterTagKey), of(VolumeFilter.TAG_VALUE, filterTagValue), of(VolumeFilter.VOLUME_ID, filterVolumeId), of(VolumeFilter.VOLUME_TYPE, filterVolumeType)); final FilterInputs.Builder filterInputsBuilder = new FilterInputs.Builder().withDelimiter(delimiter); for (ImmutablePair<String, String> filterPair : filterPairs) { if (isNotEmpty(filterPair.getRight())) { filterInputsBuilder.withNewFilter(filterPair.getLeft(), filterPair.getRight()); } } if (isNotEmpty(filterTag)) { processTagFilter(filterTag, delimiter, filterInputsBuilder); } final FilterInputs filterInputs = filterInputsBuilder.build(); return new QueryApiExecutor().execute(commonInputs, volumeInputs, filterInputs); } catch (Exception e) { return ExceptionProcessor.getExceptionResult(e); } }
From source file:io.cloudslang.content.vmware.services.DeployOvfTemplateServiceTest.java
private void verifyMockInvocationsForCreateLeaseSetupTest( ImmutablePair<ManagedObjectReference, OvfCreateImportSpecResult> result, boolean withClustername) throws Exception { Assert.assertEquals(httpNfcLeaseMock, result.getLeft()); Assert.assertEquals(ovfCreateImportSpecResultMock, result.getRight()); verifyNew(VmUtils.class).withNoArguments(); if (withClustername) { verify(vmInputsMock, times(2)).getClusterName(); verify(vmUtilsMock, times(0)).getMorResourcePool(TEST_RESOURCE_POOL, connectionResourcesMock); verifyNew(MorObjectHandler.class).withNoArguments(); verify(morObjectHandlerMock).getSpecificMor(connectionResourcesMock, morRootFolderMock, "ClusterComputeResource", TEST_CLUSTER); verify(vmUtilsMock).getMorResourcePoolFromCluster(connectionResourcesMock, clusterMorMock, TEST_RESOURCE_POOL);/*from www .j a va2 s . c om*/ } else { verify(vmInputsMock).getClusterName(); verify(vmUtilsMock).getMorResourcePool(TEST_RESOURCE_POOL, connectionResourcesMock); verify(vmUtilsMock, times(0)).getMorResourcePoolFromCluster(connectionResourcesMock, clusterMorMock, TEST_RESOURCE_POOL); } verify(vmUtilsMock).getMorHost(anyString(), any(ConnectionResources.class), any(ManagedObjectReference.class)); verify(vmUtilsMock).getMorDataStore(anyString(), any(ConnectionResources.class), any(ManagedObjectReference.class), any(VmInputs.class)); verify(vmUtilsMock).getMorFolder(anyString(), any(ConnectionResources.class)); verify(connectionResourcesMock).getVimPortType(); verify(vimPortTypeMock).createImportSpec(ovfManagerMock, OVF_TEMPLATE_AS_STRING, resourcePoolMock, datastoreMock, ovfCreateImportSpecParamsMock); }
From source file:edu.umich.flowfence.service.KVSSharedPrefs.java
@Override @SuppressWarnings("unchecked") public synchronized Map<String, ?> getAll() { checkRead();/* w w w .ja v a2 s. c om*/ TaintSet.Builder tsb = new TaintSet.Builder(); Map<String, Object> data = new HashMap<>(); for (Map.Entry<ImmutablePair<String, String>, ?> entry : mPrefs.getAll().entrySet()) { ImmutablePair<String, String> typeAndKey = entry.getKey(); if (DATA.equals(typeAndKey.getLeft())) { // If this is a data entry, remember it. data.put(typeAndKey.getRight(), entry.getValue()); } else if (TAINT.equals(typeAndKey.getKey())) { // If this is a taint entry, add it to the overall taint label. tsb.unionWith((TaintSet) entry.getValue()); } } if (mSandbox != null) { mSandbox.addTaint(tsb.build()); } return data; }
From source file:io.cloudslang.content.vmware.services.DeployOvfTemplateService.java
public void deployOvfTemplate(final HttpInputs httpInputs, final VmInputs vmInputs, final String templatePath, final Map<String, String> ovfNetworkMap, final Map<String, String> ovfPropertyMap) throws Exception { final ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try {/*from w w w . ja va2 s . c om*/ final ImmutablePair<ManagedObjectReference, OvfCreateImportSpecResult> pair = createLeaseSetup( connectionResources, vmInputs, templatePath, ovfNetworkMap, ovfPropertyMap); final ManagedObjectReference httpNfcLease = pair.getLeft(); final OvfCreateImportSpecResult importSpecResult = pair.getRight(); final HttpNfcLeaseInfo httpNfcLeaseInfo = getHttpNfcLeaseInfoWhenReady(connectionResources, httpNfcLease); final List<HttpNfcLeaseDeviceUrl> deviceUrls = httpNfcLeaseInfo.getDeviceUrl(); final ProgressUpdater progressUpdater = executor.isParallel() ? new AsyncProgressUpdater(getDisksTotalNoBytes(importSpecResult), httpNfcLease, connectionResources) : new SyncProgressUpdater(getDisksTotalNoBytes(importSpecResult), httpNfcLease, connectionResources); executor.execute(progressUpdater); transferVmdkFiles(templatePath, importSpecResult, deviceUrls, progressUpdater); executor.shutdown(); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
From source file:edu.umich.flowfence.service.NamespaceSharedPrefs.java
public synchronized Map<String, ?> getAll(String namespace) { if (mTaintSetNamespace.equals(Objects.requireNonNull(namespace))) { throw new IllegalArgumentException("Bad namespace " + namespace); }/*w ww . j a v a 2 s. c om*/ final Map<String, ?> all = mBasePrefs.getAll(); final Map<String, Object> rv = new HashMap<>(); final boolean isTaintNS = mTaintNamespaces.contains(namespace); for (Map.Entry<String, ?> entry : all.entrySet()) { final ImmutablePair<String, String> typeAndKey = getTypeAndKey(entry.getKey()); if (namespace.equals(typeAndKey.getLeft())) { final Object value; if (isTaintNS) { value = getTaintById((Integer) entry.getValue()); } else { value = entry.getValue(); } rv.put(typeAndKey.getRight(), value); } } return rv; }
From source file:com.capitati.omtc.core.negotiation.Negotiator.java
private boolean isClientAPISupported(ISemanticVersion version) { final ImmutablePair<Integer, SemanticVersionComponent> versionComp = SemanticVersionComparator .compare(apiVersion, version); boolean isApiSupported = false; switch (versionComp.getRight()) { case PRE_RELEASE_AND_BUILD_VERSION: case PATCH_VERSION: case MINOR_VERSION: isApiSupported = true;//from w w w .ja va2 s.c o m break; case MAJOR_VERSION: case INVALID: isApiSupported = (versionComp.getLeft() == 0) ? true : false; break; } return isApiSupported; }
From source file:edu.umich.flowfence.service.NamespaceSharedPrefs.java
public synchronized Map<ImmutablePair<String, String>, ?> getAll() { Map<String, ?> all = mBasePrefs.getAll(); Map<ImmutablePair<String, String>, Object> rv = new HashMap<>(all.size()); for (Map.Entry<String, ?> entry : all.entrySet()) { ImmutablePair<String, String> typeAndKey = getTypeAndKey(entry.getKey()); Object value;/*from w w w.ja va2s . c om*/ if (mTaintSetNamespace.equals(typeAndKey.getLeft())) { continue; } else if (mTaintNamespaces.contains(typeAndKey.getLeft())) { // Replace this with the appropriate TaintSet. value = getTaintById((Integer) entry.getValue()); } else { value = entry.getValue(); } rv.put(typeAndKey, value); } return rv; }
From source file:io.cloudslang.content.amazon.actions.network.DescribeNetworkInterfacesAction.java
/** * Describes one or more of your network interfaces. * * @param endpoint Optional - Endpoint to which request will be sent. * Default: "https://ec2.amazonaws.com" * @param identity ID of the secret access key associated with your Amazon AWS or * IAM account. * Example: "AKIAIOSFODNN7EXAMPLE" * @param credential Secret access key associated with your Amazon AWS or IAM account. * Example: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" * @param proxyHost Optional - proxy server used to connect to Amazon API. If empty no * proxy will be used. * @param proxyPort Optional - proxy server port. You must either specify values for both * proxyHost and proxyPort inputs or leave them both empty. * @param proxyUsername Optional - proxy server user name. * Default: "" * @param proxyPassword Optional - proxy server password associated with the proxyUsername * input value. * @param version Optional - Version of the web service to made the call against it. * Example: "2016-11-15" * Default: "2016-11-15" * @param headers Optional - string containing the headers to use for the request * separated by new line (CRLF). The header name-value pair will be * separated by ":" * Format: Conforming with HTTP standard for headers (RFC 2616) * Examples: "Accept:text/plain" * Default: "" * @param queryParams Optional - string containing query parameters that will be appended * to the URL. The names and the values must not be URL encoded because * if they are encoded then a double encoded will occur. The separator * between name-value pairs is "&" symbol. The query name will be * separated from query value by "=" * Examples: "parameterName1=parameterValue1¶meterName2=parameterValue2" * Default: "" * @param delimiter Optional - Delimiter that will be used. * @param filterAddressesPrivateIpAddress Optional - The private IPv4 addresses associated with the network * interface. * @param filterAddressesPrimary Optional - Whether the private IPv4 address is the primary IP address * associated with the network interface. * @param filterAddressesAssociationPublicIp Optional - The association ID returned when the network interface was * associated with the Elastic IP address (IPv4). * @param filterAddressesAssociationOwnerId Optional - The owner ID of the addresses associated with the network * interface. * @param filterAssociationAssociationId Optional - The association ID returned when the network interface * was associated with an IPv4 address. * @param filterAssociationAllocationId Optional - The allocation ID returned when you allocated the Elastic * IP address (IPv4) for your network interface. * @param filterAssociationIpOwnerId Optional - The owner of the Elastic IP address (IPv4) associated * with the network interface. * @param filterAssociationPublicIp Optional - The address of the Elastic IP address (IPv4) bound to the * network interface. * @param filterAssociationPublicDnsName Optional - The public DNS name for the network interface (IPv4). * @param filterAttachmentAttachmentId Optional - The ID of the interface attachment. * @param filterAttachmentAttachTime Optional - The time that the network interface was attached to an * instance. * @param filterAttachmentDeleteOnTermination Optional - Indicates whether the attachment is deleted when an * instance is terminated. * @param filterAttachmentDeviceIndex Optional - The device index to which the network interface is attached. * @param filterAttachmentInstanceId Optional - The ID of the instance to which the network interface is * attached. * @param filterAttachmentInstanceOwnerId Optional - The owner ID of the instance to which the network * interface is attached. * @param filterAttachmentNatGatewayId Optional - The ID of the NAT gateway to which the network interface * is attached. * @param filterAttachmentStatus Optional - The status of the attachment. * Valid values: attaching, attached, detaching, detached. * @param filterAvailabilityZone Optional - The Availability Zone of the network interface. * @param filterDescription Optional - The description of the network interface. * @param filterGroupId Optional - The ID of a security group associated with the network * interface. * @param filterGroupName Optional - The name of a security group associated with the network * interface. * @param filterIpv6AddressesIpv6Address Optional - An IPv6 address associated with the network interface. * @param filterMacAddress Optional - The MAC address of the network interface. * @param filterNetworkInterfaceId Optional - The ID of the network interface. * @param filterOwnerId Optional - The AWS account ID of the network interface owner. * @param filterPrivateIpAddress Optional - The private IPv4 address or addresses of the network * interface. * @param filterPrivateDnsName Optional - The private DNS name of the network interface (IPv4). * @param filterRequesterId Optional - The ID of the entity that launched the instance on your * behalf (for example, AWS Management Console, Auto Scaling, and so on). * @param filterRequesterManaged Optional - Indicates whether the network interface is being managed * by an AWS service (for example, AWS Management Console, Auto Scaling, * and so on). * @param filterSourceDestCheck Optional - Indicates whether the network interface performs * source/destination checking. A value of true means checking is * enabled, and false means checking is disabled. The value must be * false for the network interface to perform network address * translation (NAT) in your VPC. * @param filterStatus Optional - The status of the network interface. If the network * interface is not attached to an instance, the status is available; * if a network interface is attached to an instance the status is in-use. * Valid values: in-use, available. * @param filterSubnetId Optional - The ID of the subnet for the network interface. * @param filterTag Optional - The key/value combination of a tag assigned to the resource. * Specify the key of the tag in the filter name and the value of the * tag in the filter value. * Example: Purpose1=X,Purpose2=B * @param filterTagKey Optional - The key of a tag assigned to the resource. This filter is * independent of the filterTagValue filter. For example, if you use both * filterTagKey = "Purpose" and filterTagValue = "X", you get any * resources assigned both the tag key Purpose (regardless of what * the tag's value is), and the tag value X (regardless of what the * tag's key is). If you want to list only resources where Purpose is X, * see the filterTag. * @param filterTagValue Optional - The value of a tag assigned to the resource. This filter * is independent of the filterTagKey. * @param filterVpcId Optional - The ID of the VPC for the network interface. * @param networkInterfaceId Optional - String that contains one or more network interface IDs. * Example: "eni-12345678,eni-87654321" * Default: "" * @return A map with strings as keys and strings as values that contains: outcome of the action (or failure message * and the exception if there is one), returnCode of the operation and the ID of the request *///from w ww .j av a2 s.c om @Action(name = "Describe Network Interfaces", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(EXCEPTION) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> execute(@Param(value = ENDPOINT) String endpoint, @Param(value = IDENTITY, required = true) String identity, @Param(value = CREDENTIAL, required = true, encrypted = true) String credential, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword, @Param(value = HEADERS) String headers, @Param(value = QUERY_PARAMS) String queryParams, @Param(value = VERSION) String version, @Param(value = DELIMITER) String delimiter, @Param(value = FILTER_ADDRESSES_PRIVATE_IP_ADDRESS) String filterAddressesPrivateIpAddress, @Param(value = FILTER_ADDRESSES_PRIMARY) String filterAddressesPrimary, @Param(value = FILTER_ADDRESSES_ASSOCIATION_PUBLIC_IP) String filterAddressesAssociationPublicIp, @Param(value = FILTER_ADDRESSES_ASSOCIATION_OWNER_ID) String filterAddressesAssociationOwnerId, @Param(value = FILTER_ASSOCIATION_ASSOCIATION_ID) String filterAssociationAssociationId, @Param(value = FILTER_ASSOCIATION_ALLOCATION_ID) String filterAssociationAllocationId, @Param(value = FILTER_ASSOCIATION_IP_OWNER_ID) String filterAssociationIpOwnerId, @Param(value = FILTER_ASSOCIATION_PUBLIC_IP) String filterAssociationPublicIp, @Param(value = FILTER_ASSOCIATION_PUBLIC_DNS_NAME) String filterAssociationPublicDnsName, @Param(value = FILTER_ATTACHMENT_ATTACHMENT_ID) String filterAttachmentAttachmentId, @Param(value = FILTER_ATTACHMENT_ATTACH_TIME) String filterAttachmentAttachTime, @Param(value = FILTER_ATTACHMENT_DELETE_ON_TERMINATION) String filterAttachmentDeleteOnTermination, @Param(value = FILTER_ATTACHMENT_DEVICE_INDEX) String filterAttachmentDeviceIndex, @Param(value = FILTER_ATTACHMENT_INSTANCE_ID) String filterAttachmentInstanceId, @Param(value = FILTER_ATTACHMENT_INSTANCE_OWNER_ID) String filterAttachmentInstanceOwnerId, @Param(value = FILTER_ATTACHMENT_NAT_GATEWAY_ID) String filterAttachmentNatGatewayId, @Param(value = FILTER_ATTACHMENT_STATUS) String filterAttachmentStatus, @Param(value = FILTER_AVAILABILITY_ZONE) String filterAvailabilityZone, @Param(value = FILTER_DESCRIPTION) String filterDescription, @Param(value = FILTER_GROUP_ID) String filterGroupId, @Param(value = FILTER_GROUP_NAME) String filterGroupName, @Param(value = FILTER_IPV6_ADDRESSES_IPV6_ADDRESS) String filterIpv6AddressesIpv6Address, @Param(value = FILTER_MAC_ADDRESS) String filterMacAddress, @Param(value = FILTER_NETWORK_INTERFACE_ID) String filterNetworkInterfaceId, @Param(value = FILTER_OWNER_ID) String filterOwnerId, @Param(value = FILTER_PRIVATE_IP_ADDRESS) String filterPrivateIpAddress, @Param(value = FILTER_PRIVATE_DNS_NAME) String filterPrivateDnsName, @Param(value = FILTER_REQUESTER_ID) String filterRequesterId, @Param(value = FILTER_REQUESTER_MANAGED) String filterRequesterManaged, @Param(value = FILTER_SOURCE_DEST_CHECK) String filterSourceDestCheck, @Param(value = FILTER_STATUS) String filterStatus, @Param(value = FILTER_SUBNET_ID) String filterSubnetId, @Param(value = FILTER_TAG) String filterTag, @Param(value = FILTER_TAG_KEY) String filterTagKey, @Param(value = FILTER_TAG_VALUE) String filterTagValue, @Param(value = FILTER_VPC_ID) String filterVpcId, @Param(value = NETWORK_INTERFACE_ID) String networkInterfaceId) { try { version = getDefaultStringInput(version, NETWORK_DEFAULT_API_VERSION); final CommonInputs commonInputs = new CommonInputs.Builder().withEndpoint(endpoint, EC2_API, EMPTY) .withIdentity(identity).withCredential(credential).withProxyHost(proxyHost) .withProxyPort(proxyPort).withProxyUsername(proxyUsername).withProxyPassword(proxyPassword) .withHeaders(headers).withQueryParams(queryParams).withVersion(version).withDelimiter(delimiter) .withAction(DESCRIBE_NETWORK_INTERFACES).withApiService(EC2_API).withRequestUri(EMPTY) .withRequestPayload(EMPTY).withHttpClientMethod(HTTP_CLIENT_METHOD_GET).build(); final NetworkInputs networkInputs = new NetworkInputs.Builder() .withNetworkInterfaceId(networkInterfaceId).build(); final List<ImmutablePair<String, String>> filterPairs = Arrays.asList( of(NetworkFilter.ADDRESSES_ASSOCIATION_OWNER_ID, filterAttachmentAttachTime), of(NetworkFilter.ADDRESSES_PRIVATE_IP_ADDRESS, filterAddressesPrivateIpAddress), of(NetworkFilter.ADDRESSES_PRIMARY, filterAddressesPrimary), of(NetworkFilter.ADDRESSES_ASSOCIATION_PUBLIC_IP, filterAddressesAssociationPublicIp), of(NetworkFilter.ADDRESSES_ASSOCIATION_OWNER_ID, filterAddressesAssociationOwnerId), of(NetworkFilter.ASSOCIATION_ASSOCIATION_ID, filterAssociationAssociationId), of(NetworkFilter.ASSOCIATION_ALLOCATION_ID, filterAssociationAllocationId), of(NetworkFilter.ASSOCIATION_IP_OWNER_ID, filterAssociationIpOwnerId), of(NetworkFilter.ASSOCIATION_PUBLIC_IP, filterAssociationPublicIp), of(NetworkFilter.ASSOCIATION_PUBLIC_DNS_NAME, filterAssociationPublicDnsName), of(NetworkFilter.ATTACHMENT_ATTACHMENT_ID, filterAttachmentAttachmentId), of(NetworkFilter.ATTACHMENT_ATTACH_TIME, filterAttachmentAttachTime), of(NetworkFilter.ATTACHMENT_DELETE_ON_TERMINATION, filterAttachmentDeleteOnTermination), of(NetworkFilter.ATTACHMENT_DEVICE_INDEX, filterAttachmentDeviceIndex), of(NetworkFilter.ATTACHMENT_INSTANCE_ID, filterAttachmentInstanceId), of(NetworkFilter.ATTACHMENT_INSTANCE_OWNER_ID, filterAttachmentInstanceOwnerId), of(NetworkFilter.ATTACHMENT_NAT_GATEWAY_ID, filterAttachmentNatGatewayId), of(NetworkFilter.ATTACHMENT_STATUS, filterAttachmentStatus), of(NetworkFilter.AVAILABILITY_ZONE, filterAvailabilityZone), of(NetworkFilter.DESCRIPTION, filterDescription), of(NetworkFilter.GROUP_ID, filterGroupId), of(NetworkFilter.GROUP_NAME, filterGroupName), of(NetworkFilter.IPV6_ADDRESSES_IPV6_ADDRESS, filterIpv6AddressesIpv6Address), of(NetworkFilter.MAC_ADDRESS, filterMacAddress), of(NetworkFilter.NETWORK_INTERFACE_ID, filterNetworkInterfaceId), of(NetworkFilter.OWNER_ID, filterOwnerId), of(NetworkFilter.PRIVATE_IP_ADDRESS, filterPrivateIpAddress), of(NetworkFilter.PRIVATE_DNS_NAME, filterPrivateDnsName), of(NetworkFilter.REQUESTER_ID, filterRequesterId), of(NetworkFilter.REQUESTER_MANAGED, filterRequesterManaged), of(NetworkFilter.SOURCE_DEST_CHECK, filterSourceDestCheck), of(NetworkFilter.STATUS, filterStatus), of(NetworkFilter.SUBNET_ID, filterSubnetId), of(NetworkFilter.TAG_KEY, filterTagKey), of(NetworkFilter.TAG_VALUE, filterTagValue), of(NetworkFilter.VPC_ID, filterVpcId)); final FilterInputs.Builder filterInputsBuilder = new FilterInputs.Builder() .withDelimiter(commonInputs.getDelimiter()); for (ImmutablePair<String, String> filterPair : filterPairs) { if (isNotEmpty(filterPair.getRight())) { filterInputsBuilder.withNewFilter(filterPair.getLeft(), filterPair.getRight()); } } if (isNotEmpty(filterTag)) { processTagFilter(filterTag, commonInputs.getDelimiter(), filterInputsBuilder); } final FilterInputs filterInputs = filterInputsBuilder.build(); return new QueryApiExecutor().execute(commonInputs, networkInputs, filterInputs); } catch (Exception exception) { return ExceptionProcessor.getExceptionResult(exception); } }