mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-04-24 18:00:57 -04:00
Added gophercloud startstop dependency
This commit is contained in:
committed by
Dmytro Aleksandrov
parent
004cec60b3
commit
20bb0b352a
5
vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/startstop/doc.go
generated
vendored
Normal file
5
vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/startstop/doc.go
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
Package startstop provides functionality to start and stop servers that have
|
||||
been provisioned by the OpenStack Compute service.
|
||||
*/
|
||||
package startstop
|
||||
29
vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/startstop/fixtures.go
generated
vendored
Normal file
29
vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/startstop/fixtures.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// +build fixtures
|
||||
|
||||
package startstop
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
th "github.com/rackspace/gophercloud/testhelper"
|
||||
"github.com/rackspace/gophercloud/testhelper/client"
|
||||
)
|
||||
|
||||
func mockStartServerResponse(t *testing.T, id string) {
|
||||
th.Mux.HandleFunc("/servers/"+id+"/action", func(w http.ResponseWriter, r *http.Request) {
|
||||
th.TestMethod(t, r, "POST")
|
||||
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
|
||||
th.TestJSONRequest(t, r, `{"os-start": null}`)
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
})
|
||||
}
|
||||
|
||||
func mockStopServerResponse(t *testing.T, id string) {
|
||||
th.Mux.HandleFunc("/servers/"+id+"/action", func(w http.ResponseWriter, r *http.Request) {
|
||||
th.TestMethod(t, r, "POST")
|
||||
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
|
||||
th.TestJSONRequest(t, r, `{"os-stop": null}`)
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
})
|
||||
}
|
||||
23
vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/startstop/requests.go
generated
vendored
Normal file
23
vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/startstop/requests.go
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
package startstop
|
||||
|
||||
import "github.com/rackspace/gophercloud"
|
||||
|
||||
func actionURL(client *gophercloud.ServiceClient, id string) string {
|
||||
return client.ServiceURL("servers", id, "action")
|
||||
}
|
||||
|
||||
// Start is the operation responsible for starting a Compute server.
|
||||
func Start(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {
|
||||
var res gophercloud.ErrResult
|
||||
reqBody := map[string]interface{}{"os-start": nil}
|
||||
_, res.Err = client.Post(actionURL(client, id), reqBody, nil, nil)
|
||||
return res
|
||||
}
|
||||
|
||||
// Stop is the operation responsible for stopping a Compute server.
|
||||
func Stop(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {
|
||||
var res gophercloud.ErrResult
|
||||
reqBody := map[string]interface{}{"os-stop": nil}
|
||||
_, res.Err = client.Post(actionURL(client, id), reqBody, nil, nil)
|
||||
return res
|
||||
}
|
||||
Reference in New Issue
Block a user