Class ArnIndex

  • All Implemented Interfaces:
    KnowledgeIndex

    public final class ArnIndex
    extends java.lang.Object
    implements KnowledgeIndex
    Resolves and indexes the ARN templates for each resource in a service.
    • Constructor Detail

      • ArnIndex

        public ArnIndex​(Model model)
    • Method Detail

      • getServiceArnNamespace

        public java.lang.String getServiceArnNamespace​(ToShapeId serviceId)
        Gets the ARN service namespace of a service shape.
        Parameters:
        serviceId - Service shape to get ARN namespace of.
        Returns:
        Returns the resolved ARN service namespace, defaulting to the lowercase shape name if not known.
      • getServiceResourceArns

        public java.util.Map<ShapeId,​ArnTrait> getServiceResourceArns​(ToShapeId service)
        Gets all of the mappings of resources within a service to its arnTemplate trait.
        Parameters:
        service - Service to retrieve.
        Returns:
        Returns the mapping of resource ID to arnTemplate traits.
      • getEffectiveOperationArn

        public 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.

        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.

        Parameters:
        service - Service the operation is bound within.
        operation - Operation shape for which to find the effective ARN.
        Returns:
        Returns the optionally found effective ARN.
      • getFullResourceArnTemplate

        public 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.

        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.

        Parameters:
        service - Service shape ID.
        resource - Resource shape ID.
        Returns:
        Returns the optionally found ARN template for a resource.