Class AwsTagIndex
java.lang.Object
software.amazon.smithy.aws.traits.tagging.AwsTagIndex
- All Implemented Interfaces:
software.amazon.smithy.model.knowledge.KnowledgeIndex
public final class AwsTagIndex
extends Object
implements software.amazon.smithy.model.knowledge.KnowledgeIndex
Index of AWS tagging trait information in a service closure and convenient
access to tag operations by name in service closures.
-
Method Summary
Modifier and TypeMethodDescriptionOptional<software.amazon.smithy.model.shapes.ShapeId>getListTagsForResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceOrResourceId) Gets the ShapeID of the ListTagsForResource operation on the service shape if one is found meeting the criteria.Optional<software.amazon.smithy.model.shapes.ShapeId>getTagResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceOrResourceId) Gets the ShapeID of the TagResource operation on the shape if one is found by name.static Optional<software.amazon.smithy.model.shapes.MemberShape>getTagsMember(software.amazon.smithy.model.Model model, software.amazon.smithy.model.shapes.OperationShape tagResourceOperation) Returns the input member that has a name which matches for tags on a TagResource operation.Optional<software.amazon.smithy.model.shapes.ShapeId>getUntagResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceOrResourceId) Gets the ShapeID of the UntagResource operation on the shape if one is found meeting the criteria.booleanisResourceTagOnCreate(software.amazon.smithy.model.shapes.ShapeId resourceId) Checks if the given ShapeID references a resource shape that meets tag on create criteria.booleanisResourceTagOnUpdate(software.amazon.smithy.model.shapes.ShapeId resourceId) Checks if the given ShapeID references a resource shape that meets tag on update criteria.static AwsTagIndexof(software.amazon.smithy.model.Model model) booleanserviceHasTagApis(software.amazon.smithy.model.shapes.ShapeId serviceShapeId) Checks if a given ShapeID references a service shape that meets the criteria for having the three expected service-wide tagging APIs.booleanserviceHasValidListTagsForResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceId) Gets the verification result of whether or not the service has a named ListTagsForResource operation that meets the expected critiera for ListTagsForResource.booleanserviceHasValidTagResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceId) Gets the verification result of whether or not the service has a named TagResource operation that meets the expected critiera for TagResource.booleanserviceHasValidUntagResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceId) Gets the verification result of whether or not the service has a named UntagResource operation that meets the expected critiera for UntagResource.
-
Method Details
-
of
-
isResourceTagOnCreate
public boolean isResourceTagOnCreate(software.amazon.smithy.model.shapes.ShapeId resourceId) Checks if the given ShapeID references a resource shape that meets tag on create criteria. If the given ShapeID does not reference a resource shape, will always return false. Tag on create is satisfied when a resource shape has a property representing tags via the , and that property is an input on the resource's create lifecycle operation.- Parameters:
resourceId- ShapeID of the resource to check.- Returns:
- true iff the resourceId references a resource shape that has tag-on create behavior.
-
isResourceTagOnUpdate
public boolean isResourceTagOnUpdate(software.amazon.smithy.model.shapes.ShapeId resourceId) Checks if the given ShapeID references a resource shape that meets tag on update criteria. If the given ShapeID does not reference to a resource shape, will always return false. Tag on update is satisfied when a resource shape has a property representing tags via the , and that property is an input on the resource's create lifecycle operation.- Parameters:
resourceId- ShapeID of the resource to check.- Returns:
- true iff the resourceId references a resource shape that has tag-on update behavior.
-
serviceHasTagApis
public boolean serviceHasTagApis(software.amazon.smithy.model.shapes.ShapeId serviceShapeId) Checks if a given ShapeID references a service shape that meets the criteria for having the three expected service-wide tagging APIs.- Parameters:
serviceShapeId- ShapeID of the shape to check.- Returns:
- true iff the serviceShapeId references a service shape that has the necessary tagging APIs.
-
getTagResourceOperation
public Optional<software.amazon.smithy.model.shapes.ShapeId> getTagResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceOrResourceId) Gets the ShapeID of the TagResource operation on the shape if one is found by name. If a resource ID is passed in, it will return the qualifiying service wide TagResource operation ID rather than the operation ID specified by the tagApi property.- Parameters:
serviceOrResourceId- ShapeID of the service shape to retrieve the qualifying TagResource operation for.- Returns:
- The ShapeID of a qualifying TagResource operation if one is found. Returns an empty optional otherwise.
-
getUntagResourceOperation
public Optional<software.amazon.smithy.model.shapes.ShapeId> getUntagResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceOrResourceId) Gets the ShapeID of the UntagResource operation on the shape if one is found meeting the criteria. If a resource ID is passed in, it will return the qualifiying service wide TagResource operation ID rather than the operation ID specified by the tagApi property.- Parameters:
serviceOrResourceId- ShapeID of the service shape to retrieve the qualifying UntagResource operation for.- Returns:
- The ShapeID of a qualifying UntagResource operation if one is found. Returns an empty optional otherwise.
-
getListTagsForResourceOperation
public Optional<software.amazon.smithy.model.shapes.ShapeId> getListTagsForResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceOrResourceId) Gets the ShapeID of the ListTagsForResource operation on the service shape if one is found meeting the criteria. If a resource ID is passed in, it will return the qualifiying service wide TagResource operation ID rather than the operation ID specified by the tagApi property.- Parameters:
serviceOrResourceId- ShapeID of the service shape to retrieve the qualifying ListTagsForResource operation for.- Returns:
- The ShapeID of a qualifying ListTagsForResource operation if one is found. Returns an empty optional otherwise.
-
serviceHasValidTagResourceOperation
public boolean serviceHasValidTagResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceId) Gets the verification result of whether or not the service has a named TagResource operation that meets the expected critiera for TagResource.- Parameters:
serviceId- the ShapeID of the service shape the TagResource operation should be bound to.- Returns:
- True iff the service shape has a service bound operation named 'TagResource' that also satisfies the criteria for a valid TagResource operation.
-
serviceHasValidUntagResourceOperation
public boolean serviceHasValidUntagResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceId) Gets the verification result of whether or not the service has a named UntagResource operation that meets the expected critiera for UntagResource.- Parameters:
serviceId- the ShapeID of the service shape the UntagResource operation should be bound to.- Returns:
- True iff the service shape has a service bound operation named 'UntagResource' that also satisfies the criteria for a valid UntagResource operation.
-
serviceHasValidListTagsForResourceOperation
public boolean serviceHasValidListTagsForResourceOperation(software.amazon.smithy.model.shapes.ShapeId serviceId) Gets the verification result of whether or not the service has a named ListTagsForResource operation that meets the expected critiera for ListTagsForResource.- Parameters:
serviceId- the ShapeID of the service shape the ListTagsForResource operation should be bound to.- Returns:
- True iff the service shape has a service bound operation named 'ListTagsForResource' that also satisfies the criteria for a valid ListTagsForResource operation.
-
getTagsMember
public static Optional<software.amazon.smithy.model.shapes.MemberShape> getTagsMember(software.amazon.smithy.model.Model model, software.amazon.smithy.model.shapes.OperationShape tagResourceOperation) Returns the input member that has a name which matches for tags on a TagResource operation. Note: This is more of a utility method needed to expose limited access to an internal method.- Parameters:
model- Smithy model to follow member references from the provided operation shape.tagResourceOperation- TagResource operation object to scan the input members of.- Returns:
- the matching input member if present. otherwise.
-