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.ecs.model;
 
 
Container for the parameters to the CreateService operation.

Runs and maintains a desired number of tasks from a specified task definition. If the number of tasks running in a service drops below desiredCount , Amazon ECS will spawn another instantiation of the task in the specified cluster.

 
 public class CreateServiceRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The short name or full Amazon Resource Name (ARN) of the cluster that you want to run your service on. If you do not specify a cluster, the default cluster is assumed.
 
     private String cluster;

    
The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.
 
     private String serviceName;

    
The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to run in your service.
 
     private String taskDefinition;

    
A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.
 
The number of instantiations of the specified task definition that you would like to place and keep running on your cluster.
 
     private Integer desiredCount;

    
Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 64 ASCII characters are allowed.
 
     private String clientToken;

    
The name or full Amazon Resource Name (ARN) of the IAM role that allows your Amazon ECS container agent to make calls to your load balancer on your behalf. This parameter is only required if you are using a load balancer with your service.
 
     private String role;

    
The short name or full Amazon Resource Name (ARN) of the cluster that you want to run your service on. If you do not specify a cluster, the default cluster is assumed.

Returns:
The short name or full Amazon Resource Name (ARN) of the cluster that you want to run your service on. If you do not specify a cluster, the default cluster is assumed.
 
     public String getCluster() {
         return ;
     }
    
    
The short name or full Amazon Resource Name (ARN) of the cluster that you want to run your service on. If you do not specify a cluster, the default cluster is assumed.

Parameters:
cluster The short name or full Amazon Resource Name (ARN) of the cluster that you want to run your service on. If you do not specify a cluster, the default cluster is assumed.
    public void setCluster(String cluster) {
        this. = cluster;
    }
    
    
The short name or full Amazon Resource Name (ARN) of the cluster that you want to run your service on. If you do not specify a cluster, the default cluster is assumed.

Returns a reference to this object so that method calls can be chained together.

Parameters:
cluster The short name or full Amazon Resource Name (ARN) of the cluster that you want to run your service on. If you do not specify a cluster, the default cluster is assumed.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateServiceRequest withCluster(String cluster) {
        this. = cluster;
        return this;
    }

    
The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

Returns:
The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.
    public String getServiceName() {
        return ;
    }
    
    
The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

Parameters:
serviceName The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.
    public void setServiceName(String serviceName) {
        this. = serviceName;
    }
    
    
The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

Returns a reference to this object so that method calls can be chained together.

Parameters:
serviceName The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateServiceRequest withServiceName(String serviceName) {
        this. = serviceName;
        return this;
    }

    
The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to run in your service.

Returns:
The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to run in your service.
    public String getTaskDefinition() {
        return ;
    }
    
    
The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to run in your service.

Parameters:
taskDefinition The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to run in your service.
    public void setTaskDefinition(String taskDefinition) {
        this. = taskDefinition;
    }
    
    
The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to run in your service.

Returns a reference to this object so that method calls can be chained together.

Parameters:
taskDefinition The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to run in your service.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateServiceRequest withTaskDefinition(String taskDefinition) {
        this. = taskDefinition;
        return this;
    }

    
A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

Returns:
A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

Parameters:
loadBalancers A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.
    public void setLoadBalancers(java.util.Collection<LoadBalancerloadBalancers) {
        if (loadBalancers == null) {
            this. = null;
            return;
        }
        loadBalancersCopy.addAll(loadBalancers);
        this. = loadBalancersCopy;
    }
    
    
A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

NOTE: This method appends the values to the existing list (if any). Use setLoadBalancers(java.util.Collection) or withLoadBalancers(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
loadBalancers A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateServiceRequest withLoadBalancers(LoadBalancer... loadBalancers) {
        if (getLoadBalancers() == nullsetLoadBalancers(new java.util.ArrayList<LoadBalancer>(loadBalancers.length));
        for (LoadBalancer value : loadBalancers) {
            getLoadBalancers().add(value);
        }
        return this;
    }
    
    
A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

Returns a reference to this object so that method calls can be chained together.

Parameters:
loadBalancers A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (loadBalancers == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<LoadBalancerloadBalancersCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<LoadBalancer>(loadBalancers.size());
            loadBalancersCopy.addAll(loadBalancers);
            this. = loadBalancersCopy;
        }
        return this;
    }

    
The number of instantiations of the specified task definition that you would like to place and keep running on your cluster.

Returns:
The number of instantiations of the specified task definition that you would like to place and keep running on your cluster.
    public Integer getDesiredCount() {
        return ;
    }
    
    
The number of instantiations of the specified task definition that you would like to place and keep running on your cluster.

Parameters:
desiredCount The number of instantiations of the specified task definition that you would like to place and keep running on your cluster.
    public void setDesiredCount(Integer desiredCount) {
        this. = desiredCount;
    }
    
    
The number of instantiations of the specified task definition that you would like to place and keep running on your cluster.

Returns a reference to this object so that method calls can be chained together.

Parameters:
desiredCount The number of instantiations of the specified task definition that you would like to place and keep running on your cluster.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateServiceRequest withDesiredCount(Integer desiredCount) {
        this. = desiredCount;
        return this;
    }

    
Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 64 ASCII characters are allowed.

Returns:
Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 64 ASCII characters are allowed.
    public String getClientToken() {
        return ;
    }
    
    
Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 64 ASCII characters are allowed.

Parameters:
clientToken Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 64 ASCII characters are allowed.
    public void setClientToken(String clientToken) {
        this. = clientToken;
    }
    
    
Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 64 ASCII characters are allowed.

Returns a reference to this object so that method calls can be chained together.

Parameters:
clientToken Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 64 ASCII characters are allowed.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateServiceRequest withClientToken(String clientToken) {
        this. = clientToken;
        return this;
    }

    
The name or full Amazon Resource Name (ARN) of the IAM role that allows your Amazon ECS container agent to make calls to your load balancer on your behalf. This parameter is only required if you are using a load balancer with your service.

Returns:
The name or full Amazon Resource Name (ARN) of the IAM role that allows your Amazon ECS container agent to make calls to your load balancer on your behalf. This parameter is only required if you are using a load balancer with your service.
    public String getRole() {
        return ;
    }
    
    
The name or full Amazon Resource Name (ARN) of the IAM role that allows your Amazon ECS container agent to make calls to your load balancer on your behalf. This parameter is only required if you are using a load balancer with your service.

Parameters:
role The name or full Amazon Resource Name (ARN) of the IAM role that allows your Amazon ECS container agent to make calls to your load balancer on your behalf. This parameter is only required if you are using a load balancer with your service.
    public void setRole(String role) {
        this. = role;
    }
    
    
The name or full Amazon Resource Name (ARN) of the IAM role that allows your Amazon ECS container agent to make calls to your load balancer on your behalf. This parameter is only required if you are using a load balancer with your service.

Returns a reference to this object so that method calls can be chained together.

Parameters:
role The name or full Amazon Resource Name (ARN) of the IAM role that allows your Amazon ECS container agent to make calls to your load balancer on your behalf. This parameter is only required if you are using a load balancer with your service.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateServiceRequest withRole(String role) {
        this. = role;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getCluster() != nullsb.append("Cluster: " + getCluster() + ",");
        if (getServiceName() != nullsb.append("ServiceName: " + getServiceName() + ",");
        if (getTaskDefinition() != nullsb.append("TaskDefinition: " + getTaskDefinition() + ",");
        if (getLoadBalancers() != nullsb.append("LoadBalancers: " + getLoadBalancers() + ",");
        if (getDesiredCount() != nullsb.append("DesiredCount: " + getDesiredCount() + ",");
        if (getClientToken() != nullsb.append("ClientToken: " + getClientToken() + ",");
        if (getRole() != nullsb.append("Role: " + getRole() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getCluster() == null) ? 0 : getCluster().hashCode()); 
        hashCode = prime * hashCode + ((getServiceName() == null) ? 0 : getServiceName().hashCode()); 
        hashCode = prime * hashCode + ((getTaskDefinition() == null) ? 0 : getTaskDefinition().hashCode()); 
        hashCode = prime * hashCode + ((getLoadBalancers() == null) ? 0 : getLoadBalancers().hashCode()); 
        hashCode = prime * hashCode + ((getDesiredCount() == null) ? 0 : getDesiredCount().hashCode()); 
        hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode()); 
        hashCode = prime * hashCode + ((getRole() == null) ? 0 : getRole().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof CreateServiceRequest == falsereturn false;
        CreateServiceRequest other = (CreateServiceRequest)obj;
        
        if (other.getCluster() == null ^ this.getCluster() == nullreturn false;
        if (other.getCluster() != null && other.getCluster().equals(this.getCluster()) == falsereturn false
        if (other.getServiceName() == null ^ this.getServiceName() == nullreturn false;
        if (other.getServiceName() != null && other.getServiceName().equals(this.getServiceName()) == falsereturn false
        if (other.getTaskDefinition() == null ^ this.getTaskDefinition() == nullreturn false;
        if (other.getTaskDefinition() != null && other.getTaskDefinition().equals(this.getTaskDefinition()) == falsereturn false
        if (other.getLoadBalancers() == null ^ this.getLoadBalancers() == nullreturn false;
        if (other.getLoadBalancers() != null && other.getLoadBalancers().equals(this.getLoadBalancers()) == falsereturn false
        if (other.getDesiredCount() == null ^ this.getDesiredCount() == nullreturn false;
        if (other.getDesiredCount() != null && other.getDesiredCount().equals(this.getDesiredCount()) == falsereturn false
        if (other.getClientToken() == null ^ this.getClientToken() == nullreturn false;
        if (other.getClientToken() != null && other.getClientToken().equals(this.getClientToken()) == falsereturn false
        if (other.getRole() == null ^ this.getRole() == nullreturn false;
        if (other.getRole() != null && other.getRole().equals(this.getRole()) == falsereturn false
        return true;
    }
    
    @Override
    public CreateServiceRequest clone() {
        
            return (CreateServiceRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X