github.com/vmware/govmomi@v0.51.0/ssoadmin/methods/role.go (about) 1 // © Broadcom. All Rights Reserved. 2 // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 // SPDX-License-Identifier: Apache-2.0 4 5 package methods 6 7 import ( 8 "context" 9 10 "github.com/vmware/govmomi/ssoadmin/types" 11 "github.com/vmware/govmomi/vim25/soap" 12 "github.com/vmware/govmomi/vim25/xml" 13 ) 14 15 // Methods here are not included in the wsdl 16 17 type GrantWSTrustRoleBody struct { 18 Req *types.GrantWSTrustRole `xml:"urn:sso GrantWSTrustRole,omitempty"` 19 Res *types.GrantWSTrustRoleResponse `xml:"urn:sso GrantWSTrustRoleResponse,omitempty"` 20 Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` 21 } 22 23 func (b *GrantWSTrustRoleBody) Fault() *soap.Fault { return b.Fault_ } 24 25 func GrantWSTrustRole(ctx context.Context, r soap.RoundTripper, req *types.GrantWSTrustRole) (*types.GrantWSTrustRoleResponse, error) { 26 var reqBody, resBody GrantWSTrustRoleBody 27 28 reqBody.Req = req 29 30 if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { 31 return nil, err 32 } 33 34 return resBody.Res, nil 35 } 36 37 type RevokeWSTrustRoleBody struct { 38 Req *types.RevokeWSTrustRole `xml:"urn:sso RevokeWSTrustRole,omitempty"` 39 Res *types.RevokeWSTrustRoleResponse `xml:"urn:sso RevokeWSTrustRoleResponse,omitempty"` 40 Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` 41 } 42 43 func (b *RevokeWSTrustRoleBody) Fault() *soap.Fault { return b.Fault_ } 44 45 func RevokeWSTrustRole(ctx context.Context, r soap.RoundTripper, req *types.RevokeWSTrustRole) (*types.RevokeWSTrustRoleResponse, error) { 46 var reqBody, resBody RevokeWSTrustRoleBody 47 48 reqBody.Req = req 49 50 if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { 51 return nil, err 52 } 53 54 return resBody.Res, nil 55 } 56 57 // C14N returns the canonicalized form of LoginBody.Req, for use by sts.Signer 58 func (b *LoginBody) C14N() string { 59 req, err := xml.Marshal(b.Req) 60 if err != nil { 61 panic(err) 62 } 63 return string(req) 64 }