This repository has been archived by the owner on Jan 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
interfaces.go
91 lines (67 loc) · 4.12 KB
/
interfaces.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package armhelpers
import (
"github.com/Azure/azure-sdk-for-go/arm/authorization"
"github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/arm/disk"
"github.com/Azure/azure-sdk-for-go/arm/graphrbac"
"github.com/Azure/azure-sdk-for-go/arm/resources/resources"
"github.com/Azure/go-autorest/autorest"
)
// ACSEngineClient is the interface used to talk to an Azure environment.
// This interface exposes just the subset of Azure APIs and clients needed for
// ACS-Engine.
type ACSEngineClient interface {
//AddAcceptLanguages sets the list of languages to accept on this request
AddAcceptLanguages(languages []string)
//
// RESOURCES
// DeployTemplate can deploy a template into Azure ARM
DeployTemplate(resourceGroup, name string, template, parameters map[string]interface{}, cancel <-chan struct{}) (*resources.DeploymentExtended, error)
// EnsureResourceGroup ensures the specified resource group exists in the specified location
EnsureResourceGroup(resourceGroup, location string, managedBy *string) (*resources.Group, error)
//
// COMPUTE
// List lists VM resources
ListVirtualMachines(resourceGroup string) (compute.VirtualMachineListResult, error)
// GetVirtualMachine retrieves the specified virtual machine.
GetVirtualMachine(resourceGroup, name string) (compute.VirtualMachine, error)
// DeleteVirtualMachine deletes the specified virtual machine.
DeleteVirtualMachine(resourceGroup, name string, cancel <-chan struct{}) (<-chan compute.OperationStatusResponse, <-chan error)
// ListVirtualMachineScaleSets lists the vmss resources in the resource group
ListVirtualMachineScaleSets(resourceGroup string) (compute.VirtualMachineScaleSetListResult, error)
//
// STORAGE
// GetStorageClient uses SRP to retrieve keys, and then an authenticated client for talking to the specified storage
// account.
GetStorageClient(resourceGroup, accountName string) (ACSStorageClient, error)
//
// NETWORK
// DeleteNetworkInterface deletes the specified network interface.
DeleteNetworkInterface(resourceGroup, nicName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
//
// GRAPH
// CreateGraphAppliction creates an application via the graphrbac client
CreateGraphApplication(applicationCreateParameters graphrbac.ApplicationCreateParameters) (graphrbac.Application, error)
// CreateGraphPrincipal creates a service principal via the graphrbac client
CreateGraphPrincipal(servicePrincipalCreateParameters graphrbac.ServicePrincipalCreateParameters) (graphrbac.ServicePrincipal, error)
CreateApp(applicationName, applicationURL string, replyURLs *[]string, requiredResourceAccess *[]graphrbac.RequiredResourceAccess) (applicationID, servicePrincipalObjectID, secret string, err error)
// RBAC
CreateRoleAssignment(scope string, roleAssignmentName string, parameters authorization.RoleAssignmentCreateParameters) (authorization.RoleAssignment, error)
CreateRoleAssignmentSimple(applicationID, roleID string) error
DeleteRoleAssignmentByID(roleAssignmentNameID string) (authorization.RoleAssignment, error)
ListRoleAssignmentsForPrincipal(scope string, principalID string) (authorization.RoleAssignmentListResult, error)
// MANAGED DISKS
DeleteManagedDisk(resourceGroupName string, diskName string, cancel <-chan struct{}) (<-chan disk.OperationStatusResponse, <-chan error)
ListManagedDisksByResourceGroup(resourceGroupName string) (result disk.ListType, err error)
ListProviders() (resources.ProviderListResult, error)
// DEPLOYMENTS
// ListDeploymentOperations gets all deployments operations for a deployment.
ListDeploymentOperations(resourceGroupName string, deploymentName string, top *int32) (result resources.DeploymentOperationsListResult, err error)
// ListDeploymentOperationsNextResults retrieves the next set of results, if any.
ListDeploymentOperationsNextResults(lastResults resources.DeploymentOperationsListResult) (result resources.DeploymentOperationsListResult, err error)
}
// ACSStorageClient interface models the azure storage client
type ACSStorageClient interface {
// DeleteBlob deletes the specified blob in the specified container.
DeleteBlob(container, blob string) error
}