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;
 
 
 public class Service implements SerializableCloneable {

    
The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region:012345678910:service/my-service.
 
     private String serviceArn;

    
A user-generated string that you can use to identify your service.
 
     private String serviceName;

    
The Amazon Resource Name (ARN) of the of the cluster that hosts the service.
 
     private String clusterArn;

    
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 status of the service. The valid values are ACTIVE, DRAINING, or INACTIVE.
 
     private String status;

    
The desired number of instantiations of the task definition to keep running on the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.
 
     private Integer desiredCount;

    
The number of tasks in the cluster that are in the RUNNING state.
 
     private Integer runningCount;

    
The number of tasks in the cluster that are in the PENDING state.
 
     private Integer pendingCount;

    
The task definition to use for tasks in the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.
 
     private String taskDefinition;

    
The current state of deployments for the service.
 
The Amazon Resource Name (ARN) of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with a load balancer.
 
     private String roleArn;

    
The event stream for your service. A maximum of 100 of the latest events are displayed.
The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region:012345678910:service/my-service.

Returns:
The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region:012345678910:service/my-service.
    public String getServiceArn() {
        return ;
    }
    
    
The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region:012345678910:service/my-service.

Parameters:
serviceArn The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region:012345678910:service/my-service.
    public void setServiceArn(String serviceArn) {
        this. = serviceArn;
    }
    
    
The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region:012345678910:service/my-service.

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

Parameters:
serviceArn The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region:012345678910:service/my-service.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withServiceArn(String serviceArn) {
        this. = serviceArn;
        return this;
    }

    
A user-generated string that you can use to identify your service.

Returns:
A user-generated string that you can use to identify your service.
    public String getServiceName() {
        return ;
    }
    
    
A user-generated string that you can use to identify your service.

Parameters:
serviceName A user-generated string that you can use to identify your service.
    public void setServiceName(String serviceName) {
        this. = serviceName;
    }
    
    
A user-generated string that you can use to identify your service.

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

Parameters:
serviceName A user-generated string that you can use to identify your service.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withServiceName(String serviceName) {
        this. = serviceName;
        return this;
    }

    
The Amazon Resource Name (ARN) of the of the cluster that hosts the service.

Returns:
The Amazon Resource Name (ARN) of the of the cluster that hosts the service.
    public String getClusterArn() {
        return ;
    }
    
    
The Amazon Resource Name (ARN) of the of the cluster that hosts the service.

Parameters:
clusterArn The Amazon Resource Name (ARN) of the of the cluster that hosts the service.
    public void setClusterArn(String clusterArn) {
        this. = clusterArn;
    }
    
    
The Amazon Resource Name (ARN) of the of the cluster that hosts the service.

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

Parameters:
clusterArn The Amazon Resource Name (ARN) of the of the cluster that hosts the service.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withClusterArn(String clusterArn) {
        this. = clusterArn;
        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 Service 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.
    public Service withLoadBalancers(java.util.Collection<LoadBalancerloadBalancers) {
        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 status of the service. The valid values are ACTIVE, DRAINING, or INACTIVE.

Returns:
The status of the service. The valid values are ACTIVE, DRAINING, or INACTIVE.
    public String getStatus() {
        return ;
    }
    
    
The status of the service. The valid values are ACTIVE, DRAINING, or INACTIVE.

Parameters:
status The status of the service. The valid values are ACTIVE, DRAINING, or INACTIVE.
    public void setStatus(String status) {
        this. = status;
    }
    
    
The status of the service. The valid values are ACTIVE, DRAINING, or INACTIVE.

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

Parameters:
status The status of the service. The valid values are ACTIVE, DRAINING, or INACTIVE.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withStatus(String status) {
        this. = status;
        return this;
    }

    
The desired number of instantiations of the task definition to keep running on the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

Returns:
The desired number of instantiations of the task definition to keep running on the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.
    public Integer getDesiredCount() {
        return ;
    }
    
    
The desired number of instantiations of the task definition to keep running on the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

Parameters:
desiredCount The desired number of instantiations of the task definition to keep running on the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.
    public void setDesiredCount(Integer desiredCount) {
        this. = desiredCount;
    }
    
    
The desired number of instantiations of the task definition to keep running on the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

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

Parameters:
desiredCount The desired number of instantiations of the task definition to keep running on the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withDesiredCount(Integer desiredCount) {
        this. = desiredCount;
        return this;
    }

    
The number of tasks in the cluster that are in the RUNNING state.

Returns:
The number of tasks in the cluster that are in the RUNNING state.
    public Integer getRunningCount() {
        return ;
    }
    
    
The number of tasks in the cluster that are in the RUNNING state.

Parameters:
runningCount The number of tasks in the cluster that are in the RUNNING state.
    public void setRunningCount(Integer runningCount) {
        this. = runningCount;
    }
    
    
The number of tasks in the cluster that are in the RUNNING state.

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

Parameters:
runningCount The number of tasks in the cluster that are in the RUNNING state.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withRunningCount(Integer runningCount) {
        this. = runningCount;
        return this;
    }

    
The number of tasks in the cluster that are in the PENDING state.

Returns:
The number of tasks in the cluster that are in the PENDING state.
    public Integer getPendingCount() {
        return ;
    }
    
    
The number of tasks in the cluster that are in the PENDING state.

Parameters:
pendingCount The number of tasks in the cluster that are in the PENDING state.
    public void setPendingCount(Integer pendingCount) {
        this. = pendingCount;
    }
    
    
The number of tasks in the cluster that are in the PENDING state.

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

Parameters:
pendingCount The number of tasks in the cluster that are in the PENDING state.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withPendingCount(Integer pendingCount) {
        this. = pendingCount;
        return this;
    }

    
The task definition to use for tasks in the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

Returns:
The task definition to use for tasks in the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.
    public String getTaskDefinition() {
        return ;
    }
    
    
The task definition to use for tasks in the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

Parameters:
taskDefinition The task definition to use for tasks in the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.
    public void setTaskDefinition(String taskDefinition) {
        this. = taskDefinition;
    }
    
    
The task definition to use for tasks in the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

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

Parameters:
taskDefinition The task definition to use for tasks in the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withTaskDefinition(String taskDefinition) {
        this. = taskDefinition;
        return this;
    }

    
The current state of deployments for the service.

Returns:
The current state of deployments for the service.
    public java.util.List<DeploymentgetDeployments() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<Deployment>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The current state of deployments for the service.

Parameters:
deployments The current state of deployments for the service.
    public void setDeployments(java.util.Collection<Deploymentdeployments) {
        if (deployments == null) {
            this. = null;
            return;
        }
        deploymentsCopy.addAll(deployments);
        this. = deploymentsCopy;
    }
    
    
The current state of deployments for the service.

NOTE: This method appends the values to the existing list (if any). Use setDeployments(java.util.Collection) or withDeployments(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:
deployments The current state of deployments for the service.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withDeployments(Deployment... deployments) {
        if (getDeployments() == nullsetDeployments(new java.util.ArrayList<Deployment>(deployments.length));
        for (Deployment value : deployments) {
            getDeployments().add(value);
        }
        return this;
    }
    
    
The current state of deployments for the service.

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

Parameters:
deployments The current state of deployments for the service.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withDeployments(java.util.Collection<Deploymentdeployments) {
        if (deployments == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<DeploymentdeploymentsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<Deployment>(deployments.size());
            deploymentsCopy.addAll(deployments);
            this. = deploymentsCopy;
        }
        return this;
    }

    
The Amazon Resource Name (ARN) of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with a load balancer.

Returns:
The Amazon Resource Name (ARN) of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with a load balancer.
    public String getRoleArn() {
        return ;
    }
    
    
The Amazon Resource Name (ARN) of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with a load balancer.

Parameters:
roleArn The Amazon Resource Name (ARN) of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with a load balancer.
    public void setRoleArn(String roleArn) {
        this. = roleArn;
    }
    
    
The Amazon Resource Name (ARN) of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with a load balancer.

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

Parameters:
roleArn The Amazon Resource Name (ARN) of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with a load balancer.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withRoleArn(String roleArn) {
        this. = roleArn;
        return this;
    }

    
The event stream for your service. A maximum of 100 of the latest events are displayed.

Returns:
The event stream for your service. A maximum of 100 of the latest events are displayed.
    public java.util.List<ServiceEventgetEvents() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<ServiceEvent>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The event stream for your service. A maximum of 100 of the latest events are displayed.

Parameters:
events The event stream for your service. A maximum of 100 of the latest events are displayed.
    public void setEvents(java.util.Collection<ServiceEventevents) {
        if (events == null) {
            this. = null;
            return;
        }
        eventsCopy.addAll(events);
        this. = eventsCopy;
    }
    
    
The event stream for your service. A maximum of 100 of the latest events are displayed.

NOTE: This method appends the values to the existing list (if any). Use setEvents(java.util.Collection) or withEvents(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:
events The event stream for your service. A maximum of 100 of the latest events are displayed.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withEvents(ServiceEvent... events) {
        if (getEvents() == nullsetEvents(new java.util.ArrayList<ServiceEvent>(events.length));
        for (ServiceEvent value : events) {
            getEvents().add(value);
        }
        return this;
    }
    
    
The event stream for your service. A maximum of 100 of the latest events are displayed.

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

Parameters:
events The event stream for your service. A maximum of 100 of the latest events are displayed.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Service withEvents(java.util.Collection<ServiceEventevents) {
        if (events == null) {
            this. = null;
        } else {
            eventsCopy.addAll(events);
            this. = eventsCopy;
        }
        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 (getServiceArn() != nullsb.append("ServiceArn: " + getServiceArn() + ",");
        if (getServiceName() != nullsb.append("ServiceName: " + getServiceName() + ",");
        if (getClusterArn() != nullsb.append("ClusterArn: " + getClusterArn() + ",");
        if (getLoadBalancers() != nullsb.append("LoadBalancers: " + getLoadBalancers() + ",");
        if (getStatus() != nullsb.append("Status: " + getStatus() + ",");
        if (getDesiredCount() != nullsb.append("DesiredCount: " + getDesiredCount() + ",");
        if (getRunningCount() != nullsb.append("RunningCount: " + getRunningCount() + ",");
        if (getPendingCount() != nullsb.append("PendingCount: " + getPendingCount() + ",");
        if (getTaskDefinition() != nullsb.append("TaskDefinition: " + getTaskDefinition() + ",");
        if (getDeployments() != nullsb.append("Deployments: " + getDeployments() + ",");
        if (getRoleArn() != nullsb.append("RoleArn: " + getRoleArn() + ",");
        if (getEvents() != nullsb.append("Events: " + getEvents() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getServiceArn() == null) ? 0 : getServiceArn().hashCode()); 
        hashCode = prime * hashCode + ((getServiceName() == null) ? 0 : getServiceName().hashCode()); 
        hashCode = prime * hashCode + ((getClusterArn() == null) ? 0 : getClusterArn().hashCode()); 
        hashCode = prime * hashCode + ((getLoadBalancers() == null) ? 0 : getLoadBalancers().hashCode()); 
        hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); 
        hashCode = prime * hashCode + ((getDesiredCount() == null) ? 0 : getDesiredCount().hashCode()); 
        hashCode = prime * hashCode + ((getRunningCount() == null) ? 0 : getRunningCount().hashCode()); 
        hashCode = prime * hashCode + ((getPendingCount() == null) ? 0 : getPendingCount().hashCode()); 
        hashCode = prime * hashCode + ((getTaskDefinition() == null) ? 0 : getTaskDefinition().hashCode()); 
        hashCode = prime * hashCode + ((getDeployments() == null) ? 0 : getDeployments().hashCode()); 
        hashCode = prime * hashCode + ((getRoleArn() == null) ? 0 : getRoleArn().hashCode()); 
        hashCode = prime * hashCode + ((getEvents() == null) ? 0 : getEvents().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Service == falsereturn false;
        Service other = (Service)obj;
        
        if (other.getServiceArn() == null ^ this.getServiceArn() == nullreturn false;
        if (other.getServiceArn() != null && other.getServiceArn().equals(this.getServiceArn()) == falsereturn false
        if (other.getServiceName() == null ^ this.getServiceName() == nullreturn false;
        if (other.getServiceName() != null && other.getServiceName().equals(this.getServiceName()) == falsereturn false
        if (other.getClusterArn() == null ^ this.getClusterArn() == nullreturn false;
        if (other.getClusterArn() != null && other.getClusterArn().equals(this.getClusterArn()) == falsereturn false
        if (other.getLoadBalancers() == null ^ this.getLoadBalancers() == nullreturn false;
        if (other.getLoadBalancers() != null && other.getLoadBalancers().equals(this.getLoadBalancers()) == falsereturn false
        if (other.getStatus() == null ^ this.getStatus() == nullreturn false;
        if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == falsereturn false
        if (other.getDesiredCount() == null ^ this.getDesiredCount() == nullreturn false;
        if (other.getDesiredCount() != null && other.getDesiredCount().equals(this.getDesiredCount()) == falsereturn false
        if (other.getRunningCount() == null ^ this.getRunningCount() == nullreturn false;
        if (other.getRunningCount() != null && other.getRunningCount().equals(this.getRunningCount()) == falsereturn false
        if (other.getPendingCount() == null ^ this.getPendingCount() == nullreturn false;
        if (other.getPendingCount() != null && other.getPendingCount().equals(this.getPendingCount()) == falsereturn false
        if (other.getTaskDefinition() == null ^ this.getTaskDefinition() == nullreturn false;
        if (other.getTaskDefinition() != null && other.getTaskDefinition().equals(this.getTaskDefinition()) == falsereturn false
        if (other.getDeployments() == null ^ this.getDeployments() == nullreturn false;
        if (other.getDeployments() != null && other.getDeployments().equals(this.getDeployments()) == falsereturn false
        if (other.getRoleArn() == null ^ this.getRoleArn() == nullreturn false;
        if (other.getRoleArn() != null && other.getRoleArn().equals(this.getRoleArn()) == falsereturn false
        if (other.getEvents() == null ^ this.getEvents() == nullreturn false;
        if (other.getEvents() != null && other.getEvents().equals(this.getEvents()) == falsereturn false
        return true;
    }
    
    @Override
    public Service clone() {
        try {
            return (Servicesuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X