@@ -16,13 +16,47 @@ _To contribute, check out our [guide here](#contributing)._
16
16
17
17
| Table of Contents |
18
18
| :------------------|
19
+ | [ AWSRegionDynamicParameter] ( #awsregiondynamicparameter ) : _ Creates a dynamic parameter of current AWS regions by @jbruett_ |
19
20
| [ CalculatedProperty] ( #calculatedproperty ) : _ Create a calculated property for use in a select-object call by @corbob_ |
20
21
| [ DateTimeWriteVerbose] ( #datetimewriteverbose ) : _ Write-Verbose with the time and date pre-pended to your message by @ThmsRynr_ |
21
22
| [ Parameter-Credential] ( #parameter-credential ) : _ Add a standard credential parameter to your function by @omniomi_ |
22
23
| [ PSCustomObject] ( #pscustomobject ) : _ A simple PSCustomObject by @brettmillerb_ |
23
24
24
25
## Snippets
25
26
27
+ ### AWSRegionDynamicParameter
28
+
29
+ Creates a dynamic parameter of the current AWS regions. Includes parameter validation.
30
+
31
+ #### Snippet
32
+
33
+ ``` json
34
+ "AWSRegionDynamicParam" : {
35
+ "prefix" : " aws_region" ,
36
+ "body" : [
37
+ " DynamicParam {" ,
38
+ " \t $ParamDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary" ,
39
+ " \t $CR_ParamName = 'Region'" ,
40
+ " \t $CR_AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]" ,
41
+ " \t $CR_Attribute = New-Object System.Management.Automation.ParameterAttribute" ,
42
+ " \t $CR_Attribute.HelpMessage = 'List all the regions to be included in the document'" ,
43
+ " \t $CR_Attribute.Mandatory = $true" ,
44
+ " \t $CR_Attribute.ValueFromPipelineByPropertyName = $true" ,
45
+ " \t $CR_AttributeCollection.add($CR_Attribute)" ,
46
+ " \t $CR_intRegions = Get-AWSRegion -IncludeChina | Select-Object -ExpandProperty Region" ,
47
+ " \t $CR_intRegions += Get-AWSRegion -IncludeGovCloud | Select-Object -ExpandProperty Region" ,
48
+ " \t $CR_intRegions = $CR_intRegions | Select-Object -Unique" ,
49
+ " \t $CR_ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($CR_intRegions)" ,
50
+ " \t $CR_AttributeCollection.add($CR_ValidateSetAttribute)" ,
51
+ " \t $CR_Param = New-Object System.Management.Automation.RuntimeDefinedParameter($CR_ParamName, [String[]],$CR_AttributeCollection)" ,
52
+ " \t $ParamDictionary.Add($CR_ParamName, $CR_Param)" ,
53
+ " \t return $paramDictionary" ,
54
+ " \t }"
55
+ ],
56
+ "description" : " A dynamic parameter that builds a list of AWS regions"
57
+ }
58
+ ```
59
+
26
60
### CalculatedProperty
27
61
28
62
Create calculated property for use in Select Statements
0 commit comments