Class AwsTagIndex
- java.lang.Object
-
- software.amazon.smithy.aws.traits.tagging.AwsTagIndex
-
- All Implemented Interfaces:
KnowledgeIndex
public final class AwsTagIndex extends java.lang.Object implements KnowledgeIndex
Index of AWS tagging trait information in a service closure and convenient access to tag operations by name in service closures.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<ShapeId>
getListTagsForResourceOperation(ToShapeId serviceOrResourceId)
Gets the ShapeID of the ListTagsForResource operation on the service shape if one is found meeting the criteria.java.util.Optional<ShapeId>
getTagResourceOperation(ToShapeId serviceOrResourceId)
Gets the ShapeID of the TagResource operation on the shape if one is found by name.java.util.Optional<MemberShape>
getTagsMember(ToShapeId operation)
Returns the input member that has a name which matches for tags on a TagResource operation.java.util.Optional<ShapeId>
getUntagResourceOperation(ToShapeId serviceOrResourceId)
Gets the ShapeID of the UntagResource operation on the shape if one is found meeting the criteria.boolean
isResourceTagOnCreate(ToShapeId resourceId)
Checks if the given ShapeID references a resource shape that meets tag on create criteria.boolean
isResourceTagOnUpdate(ToShapeId resourceId)
Checks if the given ShapeID references a resource shape that meets tag on update criteria.static AwsTagIndex
of(Model model)
boolean
serviceHasTagApis(ToShapeId serviceShapeId)
Checks if a given ShapeID references a service shape that meets the criteria for having the three expected service-wide tagging APIs.boolean
serviceHasValidListTagsForResourceOperation(ToShapeId serviceId)
Gets the verification result of whether or not the service has a named ListTagsForResource operation that meets the expected critiera for ListTagsForResource.boolean
serviceHasValidTagResourceOperation(ToShapeId serviceId)
Gets the verification result of whether or not the service has a named TagResource operation that meets the expected critiera for TagResource.boolean
serviceHasValidUntagResourceOperation(ToShapeId serviceId)
Gets the verification result of whether or not the service has a named UntagResource operation that meets the expected critiera for UntagResource.
-
-
-
Method Detail
-
of
public static AwsTagIndex of(Model model)
-
getTagsMember
public java.util.Optional<MemberShape> getTagsMember(ToShapeId operation)
Returns the input member that has a name which matches for tags on a TagResource operation.- Parameters:
operation
- operation object to scan the input members of.- Returns:
- an Optional containing the matching input member if present, otherwise an empty Optional.
-
isResourceTagOnCreate
public boolean isResourceTagOnCreate(ToShapeId 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 {@see TaggableTrait}, 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(ToShapeId 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 {@see TaggableTrait}, 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(ToShapeId 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 java.util.Optional<ShapeId> getTagResourceOperation(ToShapeId 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 java.util.Optional<ShapeId> getUntagResourceOperation(ToShapeId 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 java.util.Optional<ShapeId> getListTagsForResourceOperation(ToShapeId 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(ToShapeId 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(ToShapeId 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(ToShapeId 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.
-
-