Class Fn
- Namespace
- Amazon.Runtime.Internal.Endpoints.StandardLibrary
- Assembly
- AWSSDK.Core.dll
Set of internal functions supported by ruleset conditions.
public static class Fn
- Inheritance
-
Fn
- Inherited Members
Methods
GetAttr(object, string)
Extracts part of given object graph by path
Example: Given the input object {"Thing1": "foo", "Thing2": ["index0", "index1"], "Thing3": {"SubThing": 42}} GetAttr(object, "Thing1") returns "foo" path "Thing2[0]" returns "index0" path "Thing3.SubThing" returns 42 Given the input IList list = {"foo", "bar"} GetAttr(list, "[0]") returns "foo"
Every path segment must resolve to IPropertyBag Every path segment with indexer must resolve to IList Indexers must be at the very end of the path
public static object GetAttr(object value, string path)
Parameters
Returns
Interpolate(string, Dictionary<string, object>)
Interpolate template placeholders with values from "refs" dictionary.
e.g. Template "My url scheme is {url#scheme} for {region}", where "url" and "region" are keys in refs dictionary and "scheme" is property of object refs["url"]. Uses GetAttr() to resolve {} placeholders, i.e. {object#prop1.prop2[3]} -> GetAttr(refs["object"], "prop1.prop2[3]"). {{ and }} are considered as escape sequences to allow rule authors to output a literal { and } respectively. Throws ArgumentException if template is not well formed.
public static string Interpolate(string template, Dictionary<string, object> refs)
Parameters
template
stringrefs
Dictionary<string, object>
Returns
InterpolateJson(string, Dictionary<string, object>)
Interpolate all templates in all string nodes for given json
public static string InterpolateJson(string json, Dictionary<string, object> refs)
Parameters
json
stringrefs
Dictionary<string, object>
Returns
IsSet(object)
Evaluates whether a value (such as an endpoint parameter) is set
public static bool IsSet(object value)
Parameters
value
object
Returns
IsValidHostLabel(string, bool)
Evaluates whether one or more string values are valid host labels per RFC 1123. https://www.rfc-editor.org/rfc/rfc1123#page-13 Each host label must be between [1, 63] characters, start with a number or letter, and only contain numbers, letters, or hyphens. Host label can't end with a hyphen. If allowSubDomains is true, then the provided value may be zero or more dotted subdomains which are each validated per RFC 1123.
public static bool IsValidHostLabel(string hostLabel, bool allowSubDomains)
Parameters
Returns
IsVirtualHostableS3Bucket(string, bool)
In addition to the restrictions defined in RFC 1123 and isValidHostLabel, validates that the bucket name is between [3,63] characters, does not contain upper case characters, and is not formatted as an IP4 address. Host label can't end with a hyphen.
public static bool IsVirtualHostableS3Bucket(string hostLabel, bool allowSubDomains)
Parameters
Returns
ParseArn(string)
Evaluates a string ARN value, and returns an object containing details about the parsed ARN. If the input was not a valid ARN, the function returns null.
public static Arn ParseArn(string arn)
Parameters
arn
string
Returns
ParseURL(string)
Parses url string into URL object. Given a string the function will attempt to parse the string into it’s URL components. If the string can not be parsed into a valid URL then the function will return a null. If the URL given contains a query portion, the URL MUST be rejected and the function MUST return null. We only support "http" and "https" schemas at the moment.
public static URL ParseURL(string url)
Parameters
url
string
Returns
Partition(string)
Returns partition data for a region
public static Partition Partition(string region)
Parameters
region
string
Returns
Substring(string, int, int, bool)
Computes the substring of a given string, conditionally indexing from the end of the string. When the string is long enough to fully include the substring, return the substring. Otherwise, return null. The start index is inclusive and the stop index is exclusive. The length of the returned string will always be stop-start. Substring MUST return null when the input contains non-ascii (>127) characters.
public static string Substring(string input, int start, int stop, bool reverse)
Parameters
Returns
UriEncode(string)
Given a string the function will perform uri percent-encoding
public static string UriEncode(string value)
Parameters
value
string