public final class ArnIndex extends java.lang.Object implements KnowledgeIndex
Modifier and Type | Method and Description |
---|---|
java.util.Optional<ArnTrait> |
getEffectiveOperationArn(ToShapeId service,
ToShapeId operation)
Gets the effective ARN of an operation based on the identifier bindings
of the operation bound to a resource contained within a service.
|
java.util.Optional<java.lang.String> |
getFullResourceArnTemplate(ToShapeId service,
ToShapeId resource)
Expands the relative ARN of a resource with the service name to form a
full ARN template.
|
java.lang.String |
getServiceArnNamespace(ToShapeId serviceId)
Gets the ARN service namespace of a service shape.
|
java.util.Map<ShapeId,ArnTrait> |
getServiceResourceArns(ToShapeId service)
Gets all of the mappings of resources within a service to its
arnTemplate trait.
|
static ArnIndex |
of(Model model) |
public ArnIndex(Model model)
public java.lang.String getServiceArnNamespace(ToShapeId serviceId)
serviceId
- Service shape to get ARN namespace of.public java.util.Map<ShapeId,ArnTrait> getServiceResourceArns(ToShapeId service)
service
- Service to retrieve.public java.util.Optional<ArnTrait> getEffectiveOperationArn(ToShapeId service, ToShapeId operation)
An operation bound to a resource using a collection binding has an effective ARN of the parent of the resource. An operation bound to a resource using an instance binding uses the ARN of the resource as its effective ARN.
service
- Service the operation is bound within.operation
- Operation shape for which to find the effective ARN.public java.util.Optional<java.lang.String> getFullResourceArnTemplate(ToShapeId service, ToShapeId resource)
For relative ARNs, the returned template string is in the format of
arn:{AWS::Partition}:service:{AWS::Region}:{AWS::AccountId}:resource
where "service" is the resolved ARN service name of the service and
"resource" is the resource part of the arnTemplate template.
"{AWS::Region}" is added to the template if the arnTemplate "noRegion"
value is not set to true. "{AWS::AccountId}" is added to the template if
the arnTemplate "noAccount" value is not set to true.
For example, if both "noAccount" and "noRegion" are set to true, the resolved ARN template might look like "arn:{AWS::Partition}:service:::resource".
Absolute ARN templates are returned as-is.
service
- Service shape ID.resource
- Resource shape ID.