示例#1
0
// See AccessProvider interface definition for details.
func (a *Access) Revoke(tok string) error {
	url := a.provider.AuthEndpoint + "/" + tok
	err := perigee.Delete(url, perigee.Options{
		MoreHeaders: map[string]string{
			"X-Auth-Token": a.AuthToken(),
		},
		OkCodes: []int{204},
	})
	return err
}
示例#2
0
文件: servers.go 项目: polvi/coreup
// See the CloudServersProvider interface for details.
func (gsp *genericServersProvider) DeleteSecurityGroupById(id int) error {
	err := gsp.context.WithReauth(gsp.access, func() error {
		ep := fmt.Sprintf("%s/os-security-groups/%d", gsp.endpoint, id)
		return perigee.Delete(ep, perigee.Options{
			MoreHeaders: map[string]string{
				"X-Auth-Token": gsp.access.AuthToken(),
			},
			OkCodes: []int{202},
		})
	})
	return err
}
示例#3
0
func (gsp *genericServersProvider) DeleteFloatingIp(ip FloatingIp) error {
	return gsp.context.WithReauth(gsp.access, func() error {
		ep := fmt.Sprintf("%s/os-floating-ips/%d", gsp.endpoint, ip.Id)
		return perigee.Delete(ep, perigee.Options{
			CustomClient: gsp.context.httpClient,
			MoreHeaders: map[string]string{
				"X-Auth-Token": gsp.access.AuthToken(),
			},
			OkCodes: []int{202},
		})
	})
}
示例#4
0
文件: servers.go 项目: polvi/coreup
// See the CloudServersProvider interface for details.
func (gsp *genericServersProvider) DeleteServerById(id string) error {
	err := gsp.context.WithReauth(gsp.access, func() error {
		url := gsp.endpoint + "/servers/" + id
		return perigee.Delete(url, perigee.Options{
			MoreHeaders: map[string]string{
				"X-Auth-Token": gsp.access.AuthToken(),
			},
			OkCodes: []int{204},
		})
	})
	return err
}
示例#5
0
文件: keypairs.go 项目: polvi/coreup
// See the CloudImagesProvider interface for details.
func (gsp *genericServersProvider) DeleteKeyPair(name string) error {
	err := gsp.context.WithReauth(gsp.access, func() error {
		url := gsp.endpoint + "/os-keypairs/" + name
		return perigee.Delete(url, perigee.Options{
			CustomClient: gsp.context.httpClient,
			MoreHeaders: map[string]string{
				"X-Auth-Token": gsp.access.AuthToken(),
			},
			OkCodes: []int{202},
		})
	})
	return err
}