Created
May 31, 2015 00:50
-
-
Save gcanales75/7330a5406be16034486a to your computer and use it in GitHub Desktop.
PoSh script para obtener servidores Rackspace Cloud usando REST
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $uri = "https://identity.api.rackspacecloud.com/v2.0/tokens" | |
| $user = "user" | |
| $apiKey1 = "My-API-Key" | |
| $account = "account" | |
| $passcred = @{ | |
| "username"=$user | |
| "apiKey"=$apiKey1 | |
| } | |
| $auth = @{ | |
| "apiKeyCredentials"=$passcred | |
| } | |
| $body = @{ | |
| "auth"=$auth | |
| } | |
| $bodyJSON = ConvertTo-Json $body | |
| $access = Invoke-RestMethod -Uri $uri -Method POST -ContentType 'application/json' -Body $bodyJSON | |
| $token = $access.access.token.id | |
| $uriServersListDetail = "https://dfw.servers.api.rackspacecloud.com/v2/$account/servers/detail" | |
| $bodyServersDetail = @{ | |
| "X-Auth-Token"=$token | |
| } | |
| $RaxCloud = Invoke-RestMethod -Uri $uriServersListDetail -Method GET -Headers $bodyServersDetail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment