/* * Copyright 2018-2023 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.greengrassv2.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* Contains information about a component dependency for a Lambda function component. *
* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ComponentDependencyRequirement implements Serializable, Cloneable, StructuredPojo { /** ** The component version requirement for the component dependency. *
** IoT Greengrass V2 uses semantic version constraints. For more information, see Semantic Versioning. *
*/ private String versionRequirement; /** ** The type of this dependency. Choose from the following options: *
*
* SOFT
– The component doesn't restart if the dependency changes state.
*
* HARD
– The component restarts if the dependency changes state.
*
* Default: HARD
*
* The component version requirement for the component dependency. *
** IoT Greengrass V2 uses semantic version constraints. For more information, see Semantic Versioning. *
* * @param versionRequirement * The component version requirement for the component dependency. ** IoT Greengrass V2 uses semantic version constraints. For more information, see Semantic Versioning. */ public void setVersionRequirement(String versionRequirement) { this.versionRequirement = versionRequirement; } /** *
* The component version requirement for the component dependency. *
** IoT Greengrass V2 uses semantic version constraints. For more information, see Semantic Versioning. *
* * @return The component version requirement for the component dependency. ** IoT Greengrass V2 uses semantic version constraints. For more information, see Semantic Versioning. */ public String getVersionRequirement() { return this.versionRequirement; } /** *
* The component version requirement for the component dependency. *
** IoT Greengrass V2 uses semantic version constraints. For more information, see Semantic Versioning. *
* * @param versionRequirement * The component version requirement for the component dependency. ** IoT Greengrass V2 uses semantic version constraints. For more information, see Semantic Versioning. * @return Returns a reference to this object so that method calls can be chained together. */ public ComponentDependencyRequirement withVersionRequirement(String versionRequirement) { setVersionRequirement(versionRequirement); return this; } /** *
* The type of this dependency. Choose from the following options: *
*
* SOFT
– The component doesn't restart if the dependency changes state.
*
* HARD
– The component restarts if the dependency changes state.
*
* Default: HARD
*
* SOFT
– The component doesn't restart if the dependency changes state.
*
* HARD
– The component restarts if the dependency changes state.
*
* Default: HARD
* @see ComponentDependencyType
*/
public void setDependencyType(String dependencyType) {
this.dependencyType = dependencyType;
}
/**
*
* The type of this dependency. Choose from the following options: *
*
* SOFT
– The component doesn't restart if the dependency changes state.
*
* HARD
– The component restarts if the dependency changes state.
*
* Default: HARD
*
* SOFT
– The component doesn't restart if the dependency changes state.
*
* HARD
– The component restarts if the dependency changes state.
*
* Default: HARD
* @see ComponentDependencyType
*/
public String getDependencyType() {
return this.dependencyType;
}
/**
*
* The type of this dependency. Choose from the following options: *
*
* SOFT
– The component doesn't restart if the dependency changes state.
*
* HARD
– The component restarts if the dependency changes state.
*
* Default: HARD
*
* SOFT
– The component doesn't restart if the dependency changes state.
*
* HARD
– The component restarts if the dependency changes state.
*
* Default: HARD
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComponentDependencyType
*/
public ComponentDependencyRequirement withDependencyType(String dependencyType) {
setDependencyType(dependencyType);
return this;
}
/**
*
* The type of this dependency. Choose from the following options: *
*
* SOFT
– The component doesn't restart if the dependency changes state.
*
* HARD
– The component restarts if the dependency changes state.
*
* Default: HARD
*
* SOFT
– The component doesn't restart if the dependency changes state.
*
* HARD
– The component restarts if the dependency changes state.
*
* Default: HARD
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComponentDependencyType
*/
public ComponentDependencyRequirement withDependencyType(ComponentDependencyType dependencyType) {
this.dependencyType = dependencyType.toString();
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getVersionRequirement() != null)
sb.append("VersionRequirement: ").append(getVersionRequirement()).append(",");
if (getDependencyType() != null)
sb.append("DependencyType: ").append(getDependencyType());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ComponentDependencyRequirement == false)
return false;
ComponentDependencyRequirement other = (ComponentDependencyRequirement) obj;
if (other.getVersionRequirement() == null ^ this.getVersionRequirement() == null)
return false;
if (other.getVersionRequirement() != null && other.getVersionRequirement().equals(this.getVersionRequirement()) == false)
return false;
if (other.getDependencyType() == null ^ this.getDependencyType() == null)
return false;
if (other.getDependencyType() != null && other.getDependencyType().equals(this.getDependencyType()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getVersionRequirement() == null) ? 0 : getVersionRequirement().hashCode());
hashCode = prime * hashCode + ((getDependencyType() == null) ? 0 : getDependencyType().hashCode());
return hashCode;
}
@Override
public ComponentDependencyRequirement clone() {
try {
return (ComponentDependencyRequirement) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.greengrassv2.model.transform.ComponentDependencyRequirementMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}