@@ -45,11 +45,11 @@ function Handler {
4545 [FunctionContext]$fnContext,
4646 [Parameter(Mandatory=$true)]
4747 [FunctionResponse]$fnResponse
48- )
48+ )
4949
50- $output = "Hello! Your input was: " + $fnContext.Body
50+ $output = "Hello! Your input was: " + $fnContext.Body
5151
52- $fnResponse.Body = $output
52+ $fnResponse.Body = $output
5353
5454}
5555```
@@ -63,21 +63,21 @@ function Handler {
6363 [FunctionContext]$fnContext,
6464 [Parameter(Mandatory=$true)]
6565 [FunctionResponse]$fnResponse
66- )
66+ )
6767
68- $json = $fnContext.Body | Out-String | ConvertFrom-Json
68+ $json = $fnContext.Body | Out-String | ConvertFrom-Json
6969
70- $key1 = $json.key1
71- $key2 = $json.key2
70+ $key1 = $json.key1
71+ $key2 = $json.key2
7272
73- $output = @{
74- "Your JSON input was" = @{
75- key1=$key1;
76- key2=$key2;
77- }
78- } | ConvertTo-Json -Compress
73+ $output = @{
74+ "Your JSON input was" = @{
75+ key1=$key1;
76+ key2=$key2;
77+ }
78+ } | ConvertTo-Json -Compress
7979
80- $fnResponse.Body = $output
80+ $fnResponse.Body = $output
8181
8282}
8383```
@@ -92,19 +92,19 @@ function Handler {
9292 [FunctionContext]$fnContext,
9393 [Parameter(Mandatory=$true)]
9494 [FunctionResponse]$fnResponse
95- )
95+ )
9696
97- $username = $env:USERNAME
98- $password = Get-Content "/var/openfaas/secrets/password" | ConvertTo-SecureString -AsPlainText -Force
99- $cred = New-Object System.Management.Automation.PSCredential -ArgumentList ($username, $password)
97+ $username = $env:USERNAME
98+ $password = Get-Content "/var/openfaas/secrets/password" | ConvertTo-SecureString -AsPlainText -Force
99+ $cred = New-Object System.Management.Automation.PSCredential -ArgumentList ($username, $password)
100100
101- $sessionoptions = New-PSSessionOption -SkipCACheck -SkipCNCheck
102- $output = Invoke-Command -ComputerName <winrm-server> -Authentication Negotiate -SessionOption $sessionoptions -Credential $cred -ScriptBlock {
103- Import-module ActiveDirectory
104- Get-Domain
105- }
101+ $sessionoptions = New-PSSessionOption -SkipCACheck -SkipCNCheck
102+ $output = Invoke-Command -ComputerName <winrm-server> -Authentication Negotiate -SessionOption $sessionoptions -Credential $cred -ScriptBlock {
103+ Import-module ActiveDirectory
104+ Get-Domain
105+ }
106106
107- $fnResponse.Body = $output
107+ $fnResponse.Body = $output
108108
109109}
110110```
0 commit comments