@@ -17,6 +17,7 @@ _To contribute, check out our [guide here](#contributing)._
17
17
| Table of Contents |
18
18
| :------------------|
19
19
| [ AssertMock] ( #assert_mock ) : _ Creates assert mock Pester test_ |
20
+ | [ AWSRegionDynamicParameter] ( #awsregiondynamicparameter ) : _ Creates a dynamic parameter of current AWS regions by @jbruett_ |
20
21
| [ CalculatedProperty] ( #calculatedproperty ) : _ Create a calculated property for use in a select-object call by @corbob_ |
21
22
| [ DataTable] ( #datatable ) : _ Creates a DataTable_ |
22
23
| [ DateTimeWriteVerbose] ( #datetimewriteverbose ) : _ Write-Verbose with the time and date pre-pended to your message by @ThmsRynr_ |
@@ -51,6 +52,39 @@ Creates Assert Mock for Pester Tests y @SQLDBAWithABeard
51
52
}
52
53
```
53
54
55
+ ### AWSRegionDynamicParameter
56
+
57
+ Creates a dynamic parameter of the current AWS regions. Includes parameter validation.
58
+
59
+ #### Snippet
60
+
61
+ ``` json
62
+ "AWSRegionDynamicParam" : {
63
+ "prefix" : " aws_region" ,
64
+ "body" : [
65
+ " DynamicParam {" ,
66
+ " \t $ParamDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary" ,
67
+ " \t $CR_ParamName = 'Region'" ,
68
+ " \t $CR_AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]" ,
69
+ " \t $CR_Attribute = New-Object System.Management.Automation.ParameterAttribute" ,
70
+ " \t $CR_Attribute.HelpMessage = 'List all the regions to be included in the document'" ,
71
+ " \t $CR_Attribute.Mandatory = $true" ,
72
+ " \t $CR_Attribute.ValueFromPipelineByPropertyName = $true" ,
73
+ " \t $CR_AttributeCollection.add($CR_Attribute)" ,
74
+ " \t $CR_intRegions = Get-AWSRegion -IncludeChina | Select-Object -ExpandProperty Region" ,
75
+ " \t $CR_intRegions += Get-AWSRegion -IncludeGovCloud | Select-Object -ExpandProperty Region" ,
76
+ " \t $CR_intRegions = $CR_intRegions | Select-Object -Unique" ,
77
+ " \t $CR_ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($CR_intRegions)" ,
78
+ " \t $CR_AttributeCollection.add($CR_ValidateSetAttribute)" ,
79
+ " \t $CR_Param = New-Object System.Management.Automation.RuntimeDefinedParameter($CR_ParamName, [String[]],$CR_AttributeCollection)" ,
80
+ " \t $ParamDictionary.Add($CR_ParamName, $CR_Param)" ,
81
+ " \t return $paramDictionary" ,
82
+ " \t }"
83
+ ],
84
+ "description" : " A dynamic parameter that builds a list of AWS regions"
85
+ }
86
+ ```
87
+
54
88
### CalculatedProperty
55
89
56
90
Create calculated property for use in Select Statements
@@ -122,6 +156,8 @@ Quickly add a `Write-Verbose` with the current date and time inserted before the
122
156
123
157
Quickly add a fully defined error record and throw. by @omniomi
124
158
159
+ #### Snippet
160
+
125
161
``` json
126
162
"Throw Terminating Error" : {
127
163
"prefix" : " error-terminating" ,
0 commit comments