Skip to content

Instantly share code, notes, and snippets.

@smaglio81
Created August 11, 2018 19:09
Apigee module using the Login upon load
if($global:Apigee -eq $null) {
$global:Apigee = @{}
$global:Apigee.ApiUrl = "https://api.enterprise.apigee.com/v1/organizations/"
# Use OAuth for access credentials. All public info here:
# https://docs.apigee.com/api-platform/system-administration/using-oauth2-security-apigee-edge-management-api
$global:Apigee.OAuthLogin = @{}
# get username / password for management API
$global:Apigee.OAuthLogin.Username = "store"
$global:Apigee.OAuthLogin.Password = "these"
$global:Apigee.OAuthLogin.OTPSharedSecret = "safely"
$global:Apigee.OAuthLogin.Method = "POST"
$global:Apigee.OAuthLogin.Url = "https://login.apigee.com/oauth/token"
$global:Apigee.OAuthLogin.ContentType = "application/x-www-form-urlencoded"
$global:Apigee.OAuthLogin.Headers = @{
Accept = "application/json;charset=utf-8"
Authorization = "Basic ZWRnZWNsaTplZGdlY2xpc2VjcmV0"
}
$global:Apigee.OAuthLogin.ResultObjectName = "ApigeeAccessToken"
}
# grab functions from files (from C:\Chocolatey\chocolateyinstall\helpers\chocolateyInstaller.psm1)
Resolve-Path $root\Apigee.*.ps1 |
? { -not ($_.ProviderPath.Contains(".Tests.")) } |
% { . $_.ProviderPath; }
# get authorization token
$global:Apigee.OAuthToken = Get-ApigeeAccessTokens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment