Hash type
Example
x = {"a": 1, "b": 2} echo(x) # Output: # {a=1, b=2} echo(x.keys()) # Output: # ['a','b'] echo(x.values()) # Output: # [1,2] x = {"a": 1, "b": 2} x.a = 10 echo(x) # Output: # {a=10, b=2}
Direct parent types
- Eachable2
Eachable which each() calls the callback with two arguments Direct subtypes: 2
Constructors
- Hash(obj:NormalTypeInstance)
Get all fields and their values as key-value pairs in the resulting Hash. Returns
HashExample
(1..10).Hash() # Hash {start=1, end=10, step=1}
- Hash() Source: stdlib.ngs:177
Make empty hash Returns
{}
- Hash(hl:HashLike) Source: stdlib.ngs:762
Get the underlying Hash with all the keys/values of the HashLike. Note: the returned value is not a copy. Returns
Hash
- Hash(arr:Arr) Source: stdlib.ngs:2489
Create a Hash from Arr of Arr[2] Parameters
arr Array of Arrays. Each one of the sub-arrays must have exactly two elements. Returns
HashExample
Hash([['a', 1], ['c', 3]]) # {'a': 1, 'c': 3}
- Hash(arr:Arr, field:Str) Source: stdlib.ngs:2500
Create Hash with keys being the given field of array elements and the values being corresponding arr elements. Returns
HashExample
Hash([{'x': 1}, {'x': 2}], 'x') # {1: {'x': 1}, 2: {'x': 2}}
- Hash(arr:Arr, cb:Fun) Source: stdlib.ngs:2511
Create a Hash from keys in arr using cb for values calculation Parameters
arr Keys of the hash to build cb Function to be called with one key at a time. Should calculate a value for the given key. Returns
HashExample
Hash([1,2], F(x) x*2) # {1: 2, 2: 4}
- Hash(keys:Arr, values:Arr) Source: stdlib.ngs:2523
Create a Hash from keys in "keys" and corresponding values in "values" Parameters
keys Keys for the new Hash values Values for the new Hash Returns
HashExample
Hash(["a", "b", "c"], [1,2,3]) # {"a": 1, "b": 2, "c": 3}
- Hash(e:Eachable1, key_field:Str, val_field:Str) Source: stdlib.ngs:2535
Create Hash from Arr of something that has key and value fields Parameters
e Eachable1 with all the keys and values key_field Name of the field holding the keys of newly created Hash val_field Name of the field holding the values of newly created Hash Returns
HashExample
Hash([{"Name": "n1", "Value": "v1"},{"Name": "n2", "Value": "v2"}], "Name", "Value") # {"n1": "v1", "n2": "v2"}
Methods
- +(a:Hash, b:Hash) Source: stdlib.ngs:2565
Add Hashes. Builds new hash with key-value pairs from both a and b. If same key is present in both a and b, the value from b is used. Returns
HashExample
{'a': 1, 'b': 2, 'c': 3} + {'b': 20, 'd': 40} # {'a': 1, 'b': 20, 'c': 3, 'd': 40}
- .(h:Hash, field:Str) Source: stdlib.ngs:1410
Get hash key. Example
h = {"a": 1} h.a # 1, Same as h["a"]
- .=(h:Hash, field:Str, v:Any) Source: stdlib.ngs:1416
Set hash key. Returns
vExample
h = {"a": 1} h.a = 2 # 2, Same as h["a"] = 2
- ::(h:Hash, k:Any) Source: stdlib.ngs:104
Get Hash key. Useful when calling method stored in a Hash key. Useful for working with namespaces, which are implemented as Hash instances. Example
elb = AWS::Elb(...).converge(...)
- ::=(h:Hash, k:Any, v:Any) Source: stdlib.ngs:109
Set Hash key. It's implemented to complete the :: operator. There is no particular use case.
- ==(a:Hash, b:Hash) Source: stdlib.ngs:2255
Compare two Hashes. Hashes must have same keys with same values in same order to return true. Returns
Bool
- [](h:Hash, k:Any)
Get hash value by key. Throws KeyNotFound. Returns
AnyExample
h = {"a": 1} h["a"] # 1 h["b"] # KeyNotFound exception thrown
- []=(h:Hash, k:Any, v:Any)
Set hash value. Parameters
h Target hash k Key v Value Returns
vExample
h = {"a": 1} h["a"] = 2 h["a"] # 2
- []=(h:Hash, k:Any, v:Any)
Setting same key twice is a bug. If it happens, augment_types() works on one objects but other objects are used later.
- \(name:Str, attributes:Hash, children:Arr)experimental Source: stdlib.ngs:6169
Undocumented Automatically called by NGS for syntax
\name attr1=val1 attr2=val2 ... [ ... ]
- Argv(h:Hash) Source: stdlib.ngs:4647
Convert a Hash, describing command line arguments, to array of strings, appropriate for using as argument to external process. Key-value pairs with values of type NoData (null, EmptyBox) are discarded. Key-value pairs with empty array values are discarded. Values of type Box are unboxed. For keys which are arrays of two elements, Bool value selects first (for true) or second (for false) element. For keys which are arrays of single element, Bool value selects whether the key is present or absent in the output. Example
# Typical usage: argv = Argv({'name1': value1, 'name2': value2, ...}) $(my_command $*argv) # Handling of key-value pairs Argv({"--a": 1, "-b": null}) # ['--a', 1] Argv({["-y1", "-n1"]: true, ["-y2", "-n2"]: false}) # ['-y1', '-n2'] Argv({["-y3"]: true, ["-y4"]: false}) # ["-y3"] Argv({"-a1": [], "-a2": [1,2,3]}) # ["-a2", 1, 2, 3]
- Arr(h:Hash) Source: stdlib.ngs:1864
Make Arr from Hash. Each key/value pair becomes two-items array. Returns
Arr of form [[k1, v1], [k2, v2], ...]Example
Arr({'x': 7, 'y': 8}) # [['x', 7], ['y', 8]]
- assert_hash_keys_values(actual:Any, expected:Hash, title:Str='Must be a hash with keys and values') Source: autoload/test.ngs:136
Assert actual is a Hash and it has the expected keys with expected values. Throws TestFail. Returns
actualExample
assert_hash_keys_values({'kk': 7}, {'ll': 7}) # Throws TestFail assert_hash_keys_values({'kk': 7, 'll': 8}, {'kk': 7}) # OK
- Box(h:Hash, k:Any) Source: stdlib.ngs:2820
Convert hash value indexed by the given key to a Box Parameters
k key to look in hash Returns
Box. FullBox if the hash has the element referenced by k, EmptyBox otherwise.Example
my_hash = {"a": 10, "b": 300} my_hash.Box("a").map(X*2).each(echo) # output: 20 my_hash.Box("nope").map(X*2).each(echo) # no output
- code(h:Hash) Source: stdlib.ngs:2610
Convert a Hash to NGS code that would produce the given Hash when executed. Not fully functional yet. Returns
Str
- collector(h:Hash, body:Fun) Source: stdlib.ngs:1332
Defines collector { ... collect(...) ... } behaviour for hashes Parameters
h Initial hash body The body after collector keyword and initial value, wrapped in a function "collector/{'my': 'hash'} THIS_CODE" Returns
Constructed arrayExample
arr = [{"Name": "n1", "Value": "v1"},{"Name": "n2", "Value": "v2"}] my_hash = collector/{} arr.each(F(elt) collect(elt.Name, elt.Value)) echo(my_hash) # Outputs: {n1=v1, n2=v2}
- copy(h:Hash) Source: stdlib.ngs:2602
Make shallow copy of a Hash Returns
Hash
- created(rd:ResDef, resources:Arr, props:Hash) Source: autoload/Res.ngs:201
Called by create() on new resources. Appends the new resources to the list and runs update(). Don't call directly. Parameters
resources Arr of Res
- decode(s:Str, hints:Hash={}) Source: stdlib.ngs:4994
Attempt to decode JSON. Uses decode_json().
- decode(s:Str, hints:Hash) Source: stdlib.ngs:5003
EXPERIMENTAL. KVS (key-value separator) hint for decode() Example
decode('a b\nc d', {'KVS': ' '}) == {'a': 'b', 'c': 'd'}
- decode(s:Str, hints:Hash) Source: stdlib.ngs:5012
EXPERIMENTAL. FS (field separator) hint for decode() Example
decode('a b\nc d', {'FS': ' '}) # [['a', 'b'], ['c', 'd']]
- decode(s:Str, hints:Hash) Source: stdlib.ngs:5022
EXPERIMENTAL! Do not use! Handle fields_names hint - run decode() and make Arr[Hash] from Arr[Arr] using provided fields_names Example
backup_list = fetch('backup.list', {'FS': ' ', 'fields_names': %[env role]})
- decode(s:Str, hints:Hash) Source: stdlib.ngs:5110
Parse the output of "aws" command. Extracts the array (see "s" below"). For "describe-instances", flattens the instance list. Parameters
s Str containing JSON with a Hash at top level with exactly one Arr as value hints hints.process.command.argv[0] must be 'aws' Returns
data structure, tyically an Arr at top level. If s is empty string - null.
- decode(s:Str, hints:Hash) Source: stdlib.ngs:5172
Parse the output of "find" command which does not use "-printf". Handles "-print0". Parameters
hints hints.process.command.argv[0] must be 'find' Returns
Arr of Str
- decode(s:Str, hints:Hash) Source: stdlib.ngs:5183
Parse the output of "locate" command. Parameters
hints hints.process.command.argv[0] must be 'locate' Returns
Arr of Str
- del(h:Hash, k:Any)
Delete hash key. Throws KeyNotFound if k is not in h. WARNING: this method will probably be renamed to "delete" in future versions. Parameters
h Target hash k Key Returns
hExample
h={"a": 1}; h.del("a"); h # {} h={}; h.del("a"); # KeyNotFound exception h={"a": 1, "b": 2}; h.del("a"); h # {"b": 2}
- dflt(h:Hash, k:Any, v:Any) Source: stdlib.ngs:2617
Set a key in a Hash if it's not already set Returns
Hash value, the already-existed or new.Example
my_hash.dflt(k, []).push(elt)
- Diff(a:Hash, b:Hash) Source: stdlib.ngs:3106
Compare hashes Example
diff = Diff(current_tags, target_tags) if (tags = AWS::cli_tags(diff.add + diff.change)) { r.run('update_tags/add', %(aws ec2 create-tags --resources ${r.id()} --tags $*tags)) } if (tags = diff.remove / "Key=$X") { r.run('update_tags/remove', %(aws ec2 delete-tags --resources ${r.id()} --tags $*tags)) }
- each(h:Hash, cb:Fun) Source: stdlib.ngs:2289
Iterate a Hash. Parameters
h Hash to iterate cb Function to call with successive keys and values Returns
hExample
{"a": 1, "b": 2}.each(F(k, v) echo("$k=$v")) # Outputs: "a=1" and on the next line "b=2"
- each_idx_key_val(h:Hash, cb:Fun) Source: stdlib.ngs:2331
Iterate a Hash. Parameters
h Hash to iterate cb Function to call with successive indexes, keys and values Returns
hExample
{"a": 1, "b": 2}.each_idx_key_val(F(idx, k, v) echo("[$idx] $k=$v")) # Outputs: "[0] a=1" and on the next line "[1] b=2"
- eachk(h:Hash, cb:Fun) Source: stdlib.ngs:2302
Iterate a Hash. Parameters
h Hash to iterate cb Function to call with successive keys Returns
h
- eachv(h:Hash, cb:Fun) Source: stdlib.ngs:2315
Iterate a Hash. Parameters
h Hash to iterate cb Function to call with successive values Returns
h
- encode(data:Any, hints:Hash={}) Source: stdlib.ngs:5031
Encode data as JSON if hints say that "filename" ends with ".json" Returns
Str
- fetch(filename:Str, decode_hints:Hash={}) Source: stdlib.ngs:4408
read() and decode() the given file Example
fetch("1.json") # Data structure, the parsed JSON
- fetch(url:Str, decode_hints:Hash={}) Source: stdlib.ngs:4416
Fetch HTTP(S) file and decode() it Example
fetch('https://api.myip.com') # Data structure, the parsed JSON
- fetch(decode_hints:Hash={}) Source: stdlib.ngs:4422
Read standard input and decode() it, passing "source" equals "stdin" hint. Example
fetch() # Data structure, parsed stdin
- fetch(p:Path, decode_hints:Hash={}) Source: stdlib.ngs:4426
read() and decode() the given file Example
fetch(File("1.json")) # Data structure, the parsed JSON
- filter(h:Hash, predicate:Any) Source: stdlib.ngs:2419
Filter hash. Build new hash with kev-value pairs selected by predicate. Parameters
h Source hash predicate Test function to be called with one key and one value at a time Example
{'a': 1, 'b': 2}.filter(F(k, v) k == 'a') # {'a': 1}
- get(h:Hash, k:Any, dflt:Any)
Get hash value by key or dflt if it does not exist Returns
AnyExample
h = {"a": 1} h.get("a", 10) # 1 h.get("b", 10) # 10
- get(h:Hash, k:Any) Source: stdlib.ngs:1422
Get hash value by key or null if it does not exist Example
h = {"a": 1} h.get("a") # 1 h.get("b") # null
- in(x:Any, h:Hash)
Check key presence in a Hash Returns
BoolExample
"a" in {"a": 1} # true "b" in {"a": 1} # false
- init(h:Hash) Source: stdlib.ngs:31
Trivial initialization helper for init(o, ...) Sets object fields from the supplied parameters Example
# sets t.a and t.b F init(t:MyType, a, b) init(args())
- init(hl:HashLike, h:Hash=null) Source: stdlib.ngs:753
Create a HashLike. Parameters
h If provided, used as initial value. Example
HashLike(%{a aha b bee}) # <HashLike a=aha b=bee>
- init(i:HashIter, h:Hash) Source: autoload/Iter.ngs:336
HashIter constructor. Example
i = HashIter({"a": 1, "b": 2})
- init(r:Res, def:ResDef, props:Hash) Source: autoload/Res.ngs:124
Stores def and props in r
- init(rd:AWS::ResDef, _ngs_tags:Hash) Source: autoload/AWS.ngs:183
Initialize ResDef from _ngs_tags. Sets .regions to null and .Tags to _ngs_tags.
- init(rd:AWS2::ResDef, _ngs_tags:Hash) Source: autoload/AWS2.ngs:187
Initialize ResDef from _ngs_tags. Sets ._Region to null and .Tags to _ngs_tags.
- init(pmy:ParamsMatchY, args:Arr, kwargs:Hash) Source: autoload/ArgvMatcher.ngs:15
Undocumented
- init(nd:NamespaceDescription, namespace:Hash)
Undocumented
- init(nd:NamespaceDescription, containing_nd:NamespaceDescription, name:Str, namespace:Hash)
Undocumented
- inspect(h:Hash) Source: stdlib.ngs:5676
Inspect Hash Returns
Arr of Str
- Iter(h:Hash) Source: autoload/Iter.ngs:331
Undocumented
- keys(h:Hash)
Get Hash keys as an array Returns
ArrExample
{"a": 1, "b": 2}.keys() # ['a','b']
- len(h:Hash)
Get number of key-value pairs in a Hash Returns
IntExample
{"a": 1, "b": 2}.len() # 2
- limit(h:Hash, l:Int) Source: stdlib.ngs:2584
Truncate a Hash if necessary so it would have maximum l key-value pairs. Parameters
h Source hash l Maximum elements Returns
HashExample
{"a": 1, "b": 2}.limit(1) # {"a": 1}
- ll_hash_head(h:Hash)
Low level. Do not use directly. Returns
LLHashEntry or null
- ll_hash_tail(h:Hash)
Low level. Do not use directly. Returns
LLHashEntry or null
- map(h:Hash, mapper:Fun) Source: stdlib.ngs:2347
Map a Hash Parameters
h Hash with source keys and values mapper Function to be called with keys and values from h Returns
ArrExample
{'a': 1, 'b': 2}.map(F(k, v) "${k}-$v") # ['a-1', 'b-2']
- map_idx_key_val(h:Hash, mapper:Fun) Source: stdlib.ngs:2358
Map a Hash Parameters
h Hash with source keys and values mapper Function to be called with sequential zero-based index, keys and values from h Returns
ArrExample
{'a': 1, 'b': 2}.map_idx_key_val(F(i, k, v) "${i}-${k}-$v") # ['0-a-1', '1-b-2']
- mapk(h:Hash, mapper:Fun) Source: stdlib.ngs:2377
Map Hash keys. Build new Hash with same values as in h but keys mapped by mapper. Parameters
h Source hash mapper Function to be called with keys Returns
HashExample
mapk({"a": 1}, F(k) k+"z") # {"az": 1}
- mapkv(h:Hash, mapper:Fun) Source: stdlib.ngs:2408
Map Hash keys and values. Build new Hash with keys and values mapped by mapper. Parameters
h Source hash mapper Function to be called with keys and values Example
mapkv({"a": 1}, {[A+"zz", B+10]}) # {"azz": 11}
- mapv(h:Hash, mapper:Fun) Source: stdlib.ngs:2396
Map Hash values. Build new Hash with same keys as in h but values mapped by mapper. Parameters
h Source hash mapper Function to be called with values Returns
HashExample
LEN = 3 lines_ = read("/usr/share/dict/words").lines() long_lines = lines_.filter({A.len()>LEN}) prefix_to_lines = long_lines.group(F(line) line[0..LEN]) # {"pfx1": ["pfx1a", "pfx1b", ...], "pfx2": ["pfx2a", "pfx2b", ...], ...} prefix_to_count = prefix_to_lines.mapv(len) # {"pfx1": 30, "pfx2": 35, ...} top = prefix_to_count.Arr().sort(F(a, b) b[1] <= a[1]).Hash() top .= limit(10) echo(top) # Outputs: {con=1219, dis=1001, pro=808, pre=607, com=600, int=543, tra=498, ove=431, per=422, imp=421}
- n(h:Hash)deprecated Source: stdlib.ngs:1431
Convert hash values to integers where possible Returns
New HashExample
%{k 7 kk "a"}["k"] is Str # true %{k 7 kk "a"}.n() # {'k': 7, 'kk': 'a'} %{k 7 kk "a"}.n()["k"] is Int # true
- opt_prop(rd:ResDef, name:Str, props:Hash) Source: autoload/Res.ngs:211
Get optional resource property, looking up in properties first and then in anchor. Returns
Box
- opt_prop(rd:ResDef, name:Str, props:Hash, cb:Fun) Source: autoload/Res.ngs:214
Run cb with optional resource property if it exists, uses opt_prop(ResDef, Str, Hash)
- Pred(h:Hash) Source: stdlib.ngs:237
Convert Hash to a predicate. The predicate asserts that object fields named after h hash keys return true for predicates made of corresponding hash values. Inspired by underscorejs' "matcher"
- push(t:Table, row_hash:Hash) Source: autoload/Table.ngs:76
Append given row to the table Returns
t
- req_prop(rd:ResDef, name:Str, props:Hash) Source: autoload/Res.ngs:218
Get resource property, looking up in properties first and then in anchor
- shift(h:Hash, k:Any) Source: stdlib.ngs:2639
Get the given key from a Hash and remove it from the Hash. Underlying h[k] may throw KeyNotFound. Example
h = {"a": 1} s = h.shift("a") # h == {} and s == 1
- shift(h:Hash, k:Any, dflt:Any) Source: stdlib.ngs:2649
Get a key from a Hash and remove it from the Hash. If they key is not in the Hash, return dflt Example
h = {} h.shift("a", 7) # 7
- sort(h:Hash, lte:Fun=method) Source: stdlib.ngs:2628
Sort a Hash. Parameters
lte Less-then-or-equal function to use for comparison of the keys in h Returns
HashExample
{"b": 2, "c": 3, "a": 1}.sort() # {"a": 1, "b": 2, "c": 3}
- sortk(h:Hash, lte:Fun=method) Source: stdlib.ngs:2477
Sort Hash by keys Returns
HashExample
{'b': 2, 'c': 11, 'a': 1}.sortk() # {'a': 1, 'b': 2, 'c': 11}
- stdlib_aws_straighten_tags(h:Hash) Source: stdlib.ngs:5091
Do not use directly. Subject to change. Convert "Tags" array in the given AWS resource (typically returned by AWS CLI) into Hash. Example
t = {"Tags": [{"Key": "k", "Value": "v"},{"Key": "k2", "Value": "v2"}]} # Not very convenient, is it? t.stdlib_aws_straighten_tags() t # {Tags={k=v, k2=v2}}
- store(filename:Str, data:Any, encode_hints:Hash={}) Source: stdlib.ngs:4431
encode() and write() the data to the file Returns
null (but subject to change)
- Str(h:Hash) Source: stdlib.ngs:3238
Convert Hash to string Returns
Str
- Strs(h:Hash) Source: stdlib.ngs:2575
Build array of Str where each resulting string is of the form "KEY=VALUE" Parameters
h Source hash Returns
Arr of StrExample
{'a': 1, 'b': 2}.Strs() # ['a=1', 'b=2']
- subset(smaller:Hash, larger:Hash) Source: stdlib.ngs:2260
Undocumented
- update(dst:Hash, src:Hash)
Update a Hash with key-value pairs from another Hash. For non destructive version use "dst + src". Returns
dstExample
{"a": 1, "b": 2}.update({"b": 10, "c": 20}) # {a=1, b=10, c=20}
- update(r:AWS::VpcRes, props:Hash)internal Source: autoload/AWS.ngs:284
Declarative primitive for updating AWS VPC resources
- update(r:AWS::IgwRes, props:Hash)internal Source: autoload/AWS.ngs:358
Declarative primitive for creating AWS InternetGateway resources
- update(r:AWS::RouteTableRes, props:Hash)internal Source: autoload/AWS.ngs:433
Declarative primitive for updating AWS RouteTable resources
- update(sg:AWS::SecGroupRes, props:Hash)internal Source: autoload/AWS.ngs:587
Declarative primitive for updating AWS Security Group resources
- update(r:AWS::SubnetRes, props:Hash)internal Source: autoload/AWS.ngs:672
Declarative primitive for updating AWS Subnet resources
- update(r:AWS::InstanceRes, props:Hash)internal Source: autoload/AWS.ngs:854
Declarative primitive for updating AWS Instance resources
- update(elb:AWS::ElbRes, props:Hash)internal Source: autoload/AWS.ngs:1131
Declarative primitive for updating AWS Elastic Load Balancer resources
- update(rrset:AWS::RecordSetRes, props:Hash)internal Source: autoload/AWS.ngs:1341
Declarative primitive for updating AWS Route53 RecordSet resources
- update(r:AWS2::Res, orig_props:Hash) Source: autoload/AWS2.ngs:400
Undocumented
- update(sg:AWS2::SecGroupRes, props:Hash)internal Source: autoload/AWS2.ngs:661
Declarative primitive for updating AWS Security Group resources
- update(r:AWS2::SubnetRes, props:Hash)internal Source: autoload/AWS2.ngs:747
Declarative primitive for updating AWS Subnet resources
- update(r:AWS2::InstanceRes, props:Hash)internal Source: autoload/AWS2.ngs:944
Declarative primitive for updating AWS Instance resources
- update(elb:AWS2::ElbRes, props:Hash)internal Source: autoload/AWS2.ngs:1224
Declarative primitive for updating AWS Elastic Load Balancer resources
- update(z:AWS2::ZoneRes, props:Hash) Source: autoload/AWS2.ngs:1394
Undocumented
- update(rrset:AWS2::RecordSetRes, props:Hash)internal Source: autoload/AWS2.ngs:1507
Declarative primitive for updating AWS Route53 RecordSet resources
- values(h:Hash)
Get Hash values as an array Returns
ArrExample
{"a": 1, "b": 2}.values() # [1,2]
- AWS::cli_tags(h:Hash) Source: autoload/AWS.ngs:52
Convert hash to Key=...,Value=... strings suitable for passing to AWS CLI. Returns
Arr of StrExample
diff = Diff(current_tags, target_tags) if (tags = cli_tags(diff.add + diff.change)) { r.run('add tags', %(aws ec2 create-tags --resources ${r.id()} --tags $*tags)) }
- AWS::cli_filters(h:Hash) Source: autoload/AWS.ngs:59
Convert Hash with AWS filters to command line arguments. Key-value pairs in which value is null or an EmptyBox object are discarded. TODO: make it JSON when keys or values contain special characters such as = or , Returns
Arr of Str
- AWS::cli_tags_filters(h:Hash) Source: autoload/AWS.ngs:70
Convert hash to Name=tag:...,Values=... strings suitable for passing to AWS CLI as filters. Example
filters = AWS::cli_filters({'vpc-id': ...}) vpcs = ``aws ec2 describe-vpcs --filters $*filters``
- AWS::update_tags(r:AWS::Res, props:Hash) Source: autoload/AWS.ngs:127
Don't call directly, use converge(). API subject to change. Update tags using AWS CLI "aws ec2 create-tags" and "aws ec2 delete-tags". The required AWS CLI is computed from current tags, which are expected to be in r.props.Tags, and props.Tags Returns
Do not count on this value.
- AWS2::cli_tags(h:Hash) Source: autoload/AWS2.ngs:52
Convert hash to Key=...,Value=... strings suitable for passing to AWS CLI. Returns
Arr of StrExample
diff = Diff(current_tags, target_tags) if (tags = cli_tags(diff.add + diff.change)) { r.run('add tags', %(aws ec2 create-tags --resources ${r.id()} --tags $*tags)) }
- AWS2::cli_filters(h:Hash) Source: autoload/AWS2.ngs:59
Convert Hash with AWS filters to command line arguments. Key-value pairs in which value is null or an EmptyBox object are discarded. TODO: make it JSON when keys or values contain special characters such as = or , Returns
Arr of Str
- AWS2::cli_tags_filters(h:Hash) Source: autoload/AWS2.ngs:70
Convert hash to Name=tag:...,Values=... strings suitable for passing to AWS CLI as filters. Example
filters = AWS::cli_filters({'vpc-id': ...}) vpcs = ``aws ec2 describe-vpcs --filters $*filters``
- Doc::Transformer(x:Hash) Source: autoload/Doc.ngs:90
Undocumented