Comments (5)
Good one. We can create an SRS Client PS Module and update the API pester tests to use it. I'll prepare the scaffold, feel free to put all the content there.
from script-runtime-service-for-vsphere.
Added the module manifest
https://github.com/vmware/script-runtime-service-for-vsphere/tree/master/client-sdk/powershell
@lucdekens Feel free to add content in there.
https://github.com/vmware/script-runtime-service-for-vsphere/blob/master/test/api-integration-tests/tests/SRSAPIHelpers.ps1 could help.
from script-runtime-service-for-vsphere.
Let's start with PS 7 initially, later we can add support for 5.1
from script-runtime-service-for-vsphere.
Thanks for the pointer to SRSAPIHelpers.ps1.
Question: shall the module support PSv5.1?
If yes, we have to foresee an alternative for the SkipCertificateCheck switch when invoked from PSv5.1.
Something similar to what I did in my Invoke-SrsMethod function in my A Hitchhikers Guide To SRS 1.0.0
from script-runtime-service-for-vsphere.
As a SkipCertificateCheck solution for PS 5.1 I can suggest a wrapper function like
function Invoke-RestMethodEx {
param(
# InvokeRestMethodParams,
[switch]
$SkipCertificateCheck
)
if (-not("SkipCertificateCheck" -as [type])) {
Add-Type -TypeDefinition `
("using System;" + `
"using System.Net;" + `
"using System.Net.Security;" + `
"using System.Security.Cryptography.X509Certificates;" + `
"public static class SkipCertificateCheck {" + `
"public static bool ReturnTrue(object sender," + `
"X509Certificate certificate," + `
"X509Chain chain," + `
"SslPolicyErrors sslPolicyErrors) { return true; }" + `
"public static RemoteCertificateValidationCallback GetDelegate() {" + `
"return new RemoteCertificateValidationCallback(SkipCertificateCheck.ReturnTrue);" + `
"}" + `
"}")
}
if ($SkipCertificateCheck) {
[System.Net.ServicePointManager]::ServerCertificateValidationCallback += [SkipCertificateCheck]::GetDelegate()
}
Invoke-RestMethod https://10.23.82.191/api/about
if ($SkipCertificateCheck) {
# back to previous value, for the sake of example I assume it was $null
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = $null
}
}
from script-runtime-service-for-vsphere.
Related Issues (20)
- [Feature Request] SRS only contains the PowerCLI modules HOT 1
- [Q] Can a user overwrite MaxRunspaceActiveTimeMinutes? HOT 1
- [Enhancement Request] Create upgrade SRS automation for local SRS builds HOT 1
- The vccleanup.ps1 script fails to find 'Debug' modules.
- SRS and $env:PSModulePath HOT 4
- [Q] Photon version HOT 1
- [Feature Request] pull script from configmap HOT 7
- iso_url in photon-version.json returns 401 HOT 4
- Build fails with Photon OS 3.0 Revision 3 HOT 2
- Build fails when endpoint is defined on a VDS portgroup
- [Feature Request] Make vccleanup.ps1 dotnet version independent HOT 1
- vccleanup.ps1 script fails when more than 1 SRS service is registered
- [Feature Request] Functionality without vCenter server HOT 2
- [Feature Request] Introduce a mechanism to exchange files in both directions HOT 3
- [Task] Test and test coverage for the WebConsole APIs
- [Task] WebConsole API and feature documentation
- Issue with blank line in appliance/photon-version.json
- Helm install registration fails HOT 5
- error Kubernetes cluster unreachable installing on new ovf HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from script-runtime-service-for-vsphere.