|
|
|
|
|
by macintux
2387 days ago
|
|
There are other oddities too. For example, to get a layer name from a lambda definition, the simplest/most robust process I can define: 1 Retrieve all layers with list_layers and index them by ARN 2 Retrieve all function metadata 3 For each function metadata item, extract all layer version ARNs 4 For each layer version ARN, call get_layer_version_by_arn 5 Extract the layer ARN from that result 6 Use that layer ARN to retrieve the name from the data we retrieved in step 1 |
|
If you just need the Layer Arn to call other APIs:
a) You could eliminate steps 1 and 6, and use the Layer Arn value from 5 to call APIs that require a layer name.
b) Alternatively, you could yourself chop off the version number from the Layer Version Arn string(s) in step 4, and skip the GetLayerVersionByArn call in step 5 all together.
If you explicitly require the name, not the Layer Arn:
c) You could parse it right out of the Layer Version Arn yourself.
When it comes to doing your own string manipulation for (b) or (c), there are many ways to skin a cat ... but you could use regex (the pattern is in the API documentation), or split on colons and index the second to last element in the array.
Is it useful to return the Layer Name in more APIs? What is your use-case?