Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   * 
   *  http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.elasticloadbalancing.model.transform;
 
 import java.util.List;
 import java.util.Map;
 
Create Load Balancer Request Marshaller
 
 
     public Request<CreateLoadBalancerRequestmarshall(CreateLoadBalancerRequest createLoadBalancerRequest) {
 
         if (createLoadBalancerRequest == null) {
             throw new AmazonClientException("Invalid argument passed to marshall(...)");
         }
 
         Request<CreateLoadBalancerRequestrequest = new DefaultRequest<CreateLoadBalancerRequest>(createLoadBalancerRequest"AmazonElasticLoadBalancing");
         request.addParameter("Action""CreateLoadBalancer");
         request.addParameter("Version""2012-06-01");
 
         if (createLoadBalancerRequest.getLoadBalancerName() != null) {
             request.addParameter("LoadBalancerName", StringUtils.fromString(createLoadBalancerRequest.getLoadBalancerName()));
         }
 
         java.util.List<ListenerlistenersList = createLoadBalancerRequest.getListeners();
         int listenersListIndex = 1;
 
         for (Listener listenersListValue : listenersList) {
             Listener listenerMember = listenersListValue;
             if (listenerMember != null) {
                 if (listenerMember.getProtocol() != null) {
                     request.addParameter("Listeners.member." + listenersListIndex + ".Protocol", StringUtils.fromString(listenerMember.getProtocol()));
                 }
                 if (listenerMember.getLoadBalancerPort() != null) {
                     request.addParameter("Listeners.member." + listenersListIndex + ".LoadBalancerPort", StringUtils.fromInteger(listenerMember.getLoadBalancerPort()));
                 }
                 if (listenerMember.getInstanceProtocol() != null) {
                     request.addParameter("Listeners.member." + listenersListIndex + ".InstanceProtocol", StringUtils.fromString(listenerMember.getInstanceProtocol()));
                 }
                 if (listenerMember.getInstancePort() != null) {
                     request.addParameter("Listeners.member." + listenersListIndex + ".InstancePort", StringUtils.fromInteger(listenerMember.getInstancePort()));
                 }
                 if (listenerMember.getSSLCertificateId() != null) {
                     request.addParameter("Listeners.member." + listenersListIndex + ".SSLCertificateId", StringUtils.fromString(listenerMember.getSSLCertificateId()));
                 }
             }
 
             listenersListIndex++;
         }
 
         java.util.List<StringavailabilityZonesList = createLoadBalancerRequest.getAvailabilityZones();
         int availabilityZonesListIndex = 1;
 
         for (String availabilityZonesListValue : availabilityZonesList) {
             if (availabilityZonesListValue != null) {
                 request.addParameter("AvailabilityZones.member." + availabilityZonesListIndex, StringUtils.fromString(availabilityZonesListValue));
             }
 
             availabilityZonesListIndex++;
         }
 
         java.util.List<StringsubnetsList = createLoadBalancerRequest.getSubnets();
         int subnetsListIndex = 1;
 
         for (String subnetsListValue : subnetsList) {
             if (subnetsListValue != null) {
                 request.addParameter("Subnets.member." + subnetsListIndex, StringUtils.fromString(subnetsListValue));
             }
 
             subnetsListIndex++;
         }
 
         java.util.List<StringsecurityGroupsList = createLoadBalancerRequest.getSecurityGroups();
         int securityGroupsListIndex = 1;
 
         for (String securityGroupsListValue : securityGroupsList) {
            if (securityGroupsListValue != null) {
                request.addParameter("SecurityGroups.member." + securityGroupsListIndex, StringUtils.fromString(securityGroupsListValue));
            }
            securityGroupsListIndex++;
        }
        if (createLoadBalancerRequest.getScheme() != null) {
            request.addParameter("Scheme", StringUtils.fromString(createLoadBalancerRequest.getScheme()));
        }
        java.util.List<TagtagsList = createLoadBalancerRequest.getTags();
        int tagsListIndex = 1;
        for (Tag tagsListValue : tagsList) {
            Tag tagMember = tagsListValue;
            if (tagMember != null) {
                if (tagMember.getKey() != null) {
                    request.addParameter("Tags.member." + tagsListIndex + ".Key", StringUtils.fromString(tagMember.getKey()));
                }
                if (tagMember.getValue() != null) {
                    request.addParameter("Tags.member." + tagsListIndex + ".Value", StringUtils.fromString(tagMember.getValue()));
                }
            }
            tagsListIndex++;
        }
        return request;
    }
New to GrepCode? Check out our FAQ X