forked from Azure/acs-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
groupsclient.go
26 lines (22 loc) · 849 Bytes
/
groupsclient.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package armhelpers
import (
"github.com/Azure/azure-sdk-for-go/arm/resources/resources"
"github.com/Azure/go-autorest/autorest"
"github.com/prometheus/common/log"
)
// EnsureResourceGroup ensures the named resouce group exists in the given location.
func (az *AzureClient) EnsureResourceGroup(name, location string) (resourceGroup *resources.Group, err error) {
log.Debugf("Ensuring resource group exists. resourcegroup=%q", name)
response, err := az.groupsClient.CreateOrUpdate(name, resources.Group{
Name: &name,
Location: &location,
})
if err != nil {
return &response, err
}
return &response, nil
}
// DeleteResourceGroup delete the named resource group
func (az *AzureClient) DeleteResourceGroup(name string, cancel chan struct{}) (<-chan autorest.Response, <-chan error) {
return az.groupsClient.Delete(name, cancel)
}