Class ServiceIndex
- All Implemented Interfaces:
KnowledgeIndex
This index can be used to get all of the protocol traits applied to a service, to get all of the auth defining traits applied to a service, to get the effective authentication schemes of a service, and to get the effective authentication schemes of an operation bound within the closure of a service.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines the type of auth schemes returned bygetEffectiveAuthSchemes(software.amazon.smithy.model.shapes.ToShapeId). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAuthSchemes(ToShapeId service) Get all auth defining traits attached to a service or operation.getEffectiveAuthSchemes(ToShapeId service) Gets a list of effective authentication schemes applied to a service.getEffectiveAuthSchemes(ToShapeId service, ServiceIndex.AuthSchemeMode authSchemeMode) Gets a list of effective authentication schemes applied to a service, based on the AuthSchemeMode.getEffectiveAuthSchemes(ToShapeId service, ToShapeId operation) Gets a list of effective authentication schemes applied to an operation bound within a service.getEffectiveAuthSchemes(ToShapeId service, ToShapeId operation, ServiceIndex.AuthSchemeMode authSchemeMode) Gets a list of effective authentication schemes applied to an operation bound within a service, based on the AuthSchemeMode.getProtocols(ToShapeId service) Get all protocol traits attached to a service.static ServiceIndex
-
Constructor Details
-
ServiceIndex
-
-
Method Details
-
of
-
getProtocols
Get all protocol traits attached to a service.A protocol trait is a trait that is marked with the
smithy.api#protocolDefinitiontrait.An empty map is returned if
servicecannot be found in the model or is not a service shape.- Parameters:
service- Service to get the protocols of.- Returns:
- Returns a map of the protocol trait ID to the trait.
-
getAuthSchemes
Get all auth defining traits attached to a service or operation.An auth defining trait is a trait that is marked with the
smithy.api#authDefinitiontrait.The returned map is ordered alphabetically by absolute shape ID.
An empty map is returned if
idcannot be found in the model or is not a service shape.- Parameters:
service- Service to get the auth schemes of.- Returns:
- Returns a map of the trait shape ID to the auth trait itself.
-
getEffectiveAuthSchemes
Gets a list of effective authentication schemes applied to a service.An effective authentication scheme is derived from the
smithy.api#authtrait and the auth defining traits applied to a service. If the service has thesmithy.api#authtrait, then a map is returned that contains the traits applied to the service that matches the values in the auth trait. If no auth trait is applied, then all of the auth defining traits on the service are returned.The returned map is provided in the same order as the values in the
authtrait if an auth trait is present, otherwise the result returned is ordered alphabetically by absolute shape ID.An empty map is returned if
servicecannot be found in the model or is not a service shape.- Parameters:
service- Service to get the effective authentication schemes of.- Returns:
- Returns a map of the trait shape ID to the auth trait itself.
-
getEffectiveAuthSchemes
public Map<ShapeId,Trait> getEffectiveAuthSchemes(ToShapeId service, ServiceIndex.AuthSchemeMode authSchemeMode) Gets a list of effective authentication schemes applied to a service, based on the AuthSchemeMode.If AuthSchemeMode is
MODELED, which is the default, the behavior is same asgetEffectiveAuthSchemes(ToShapeId).If AuthSchemeMode is
NO_AUTH_AWARE, the behavior is same, except that if the service has no effective auth schemes, instead of an empty map, it returns thesmithy.api#noAuthauth scheme. It avoids having to special case handling an empty result. The returned map will always contain at least 1 entry.- Parameters:
service- Service to get the effective authentication schemes of.authSchemeMode- AuthSchemeMode to determine which authentication schemes to include.- Returns:
- Returns a map of the trait shape ID to the auth trait itself.
-
getEffectiveAuthSchemes
Gets a list of effective authentication schemes applied to an operation bound within a service.If the given operation defines that
smithy.api#authtrait, then a map is returned that consists of the traits applied to the service that match the values of thesmithy.api#authtrait. If the operation does not define ansmithy.api#authtrait, then the effective auth schemes of the service is returned (that is, the return value ofgetEffectiveAuthSchemes(ToShapeId)).The returned map is provided in the same order as the values in the
authtrait if an auth trait is present, otherwise the result returned is ordered alphabetically by absolute shape ID.An empty map is returned if
serviceshape cannot be found in the model or is not a service shape. An empty map is returned ifoperationcannot be found in the model or is not an operation shape.- Parameters:
service- Service the operation is within.operation- Operation to get the effective authentication schemes of.- Returns:
- Returns a map of the trait shape ID to the auth trait itself.
-
getEffectiveAuthSchemes
public Map<ShapeId,Trait> getEffectiveAuthSchemes(ToShapeId service, ToShapeId operation, ServiceIndex.AuthSchemeMode authSchemeMode) Gets a list of effective authentication schemes applied to an operation bound within a service, based on the AuthSchemeMode.If AuthSchemeMode is
MODELED, which is the default, the behavior is same asgetEffectiveAuthSchemes(ToShapeId, ToShapeId).If AuthSchemeMode is
NO_AUTH_AWARE, the behavior is same, with the following differences: If the operation has no effective auth schemes, instead of an empty map, it returns thesmithy.api#noAuthauth scheme. If the operation has thesmithy.api#optionalAuthtrait, it addssmithy.api#noAuthto the end.Using
NO_AUTH_AWAREaccounts forsmithy.api#optionalAuthand avoids having to special case handling an empty result. The returned map will always contain at least 1 entry.The
smithy.api#noAuthscheme, if present, is always the last scheme.- Parameters:
service- Service the operation is within.operation- Operation to get the effective authentication schemes of.authSchemeMode- AuthSchemeMode to determine which authentication schemes to include.- Returns:
- Returns a map of the trait shape ID to the auth trait itself.
-