github.com/vmware/govmomi@v0.37.1/ssoadmin/methods/role.go (about) 1 /* 2 Copyright (c) 2018 VMware, Inc. All Rights Reserved. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package methods 18 19 import ( 20 "context" 21 22 "github.com/vmware/govmomi/ssoadmin/types" 23 "github.com/vmware/govmomi/vim25/soap" 24 "github.com/vmware/govmomi/vim25/xml" 25 ) 26 27 // Methods here are not included in the wsdl 28 29 type GrantWSTrustRoleBody struct { 30 Req *types.GrantWSTrustRole `xml:"urn:sso GrantWSTrustRole,omitempty"` 31 Res *types.GrantWSTrustRoleResponse `xml:"urn:sso GrantWSTrustRoleResponse,omitempty"` 32 Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` 33 } 34 35 func (b *GrantWSTrustRoleBody) Fault() *soap.Fault { return b.Fault_ } 36 37 func GrantWSTrustRole(ctx context.Context, r soap.RoundTripper, req *types.GrantWSTrustRole) (*types.GrantWSTrustRoleResponse, error) { 38 var reqBody, resBody GrantWSTrustRoleBody 39 40 reqBody.Req = req 41 42 if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { 43 return nil, err 44 } 45 46 return resBody.Res, nil 47 } 48 49 type RevokeWSTrustRoleBody struct { 50 Req *types.RevokeWSTrustRole `xml:"urn:sso RevokeWSTrustRole,omitempty"` 51 Res *types.RevokeWSTrustRoleResponse `xml:"urn:sso RevokeWSTrustRoleResponse,omitempty"` 52 Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` 53 } 54 55 func (b *RevokeWSTrustRoleBody) Fault() *soap.Fault { return b.Fault_ } 56 57 func RevokeWSTrustRole(ctx context.Context, r soap.RoundTripper, req *types.RevokeWSTrustRole) (*types.RevokeWSTrustRoleResponse, error) { 58 var reqBody, resBody RevokeWSTrustRoleBody 59 60 reqBody.Req = req 61 62 if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { 63 return nil, err 64 } 65 66 return resBody.Res, nil 67 } 68 69 // C14N returns the canonicalized form of LoginBody.Req, for use by sts.Signer 70 func (b *LoginBody) C14N() string { 71 req, err := xml.Marshal(b.Req) 72 if err != nil { 73 panic(err) 74 } 75 return string(req) 76 }