2022-09-05 03:06:08 -04:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-03-22 11:03:15 -04:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/Azure/azure-sdk-for-go/profiles/latest/authorization/mgmt/authorization"
|
2022-07-27 16:02:33 -04:00
|
|
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
2022-06-10 07:18:30 -04:00
|
|
|
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights"
|
2022-07-27 16:02:33 -04:00
|
|
|
armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2"
|
2022-03-22 11:03:15 -04:00
|
|
|
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork"
|
|
|
|
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
|
|
|
|
"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
|
|
|
|
"github.com/Azure/go-autorest/autorest"
|
|
|
|
)
|
|
|
|
|
|
|
|
type networksAPI interface {
|
|
|
|
BeginCreateOrUpdate(ctx context.Context, resourceGroupName string,
|
|
|
|
virtualNetworkName string, parameters armnetwork.VirtualNetwork,
|
|
|
|
options *armnetwork.VirtualNetworksClientBeginCreateOrUpdateOptions) (
|
2022-07-27 16:02:33 -04:00
|
|
|
*runtime.Poller[armnetwork.VirtualNetworksClientCreateOrUpdateResponse], error)
|
2022-03-22 11:03:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type networkSecurityGroupsAPI interface {
|
|
|
|
BeginCreateOrUpdate(ctx context.Context, resourceGroupName string,
|
|
|
|
networkSecurityGroupName string, parameters armnetwork.SecurityGroup,
|
|
|
|
options *armnetwork.SecurityGroupsClientBeginCreateOrUpdateOptions) (
|
2022-07-27 16:02:33 -04:00
|
|
|
*runtime.Poller[armnetwork.SecurityGroupsClientCreateOrUpdateResponse], error)
|
2022-05-24 04:04:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type loadBalancersAPI interface {
|
|
|
|
BeginCreateOrUpdate(ctx context.Context, resourceGroupName string,
|
|
|
|
loadBalancerName string, parameters armnetwork.LoadBalancer,
|
|
|
|
options *armnetwork.LoadBalancersClientBeginCreateOrUpdateOptions) (
|
2022-07-27 16:02:33 -04:00
|
|
|
*runtime.Poller[armnetwork.LoadBalancersClientCreateOrUpdateResponse], error,
|
2022-05-24 04:04:42 -04:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-03-22 11:03:15 -04:00
|
|
|
type scaleSetsAPI interface {
|
2022-08-24 05:31:43 -04:00
|
|
|
Get(ctx context.Context, resourceGroupName string, vmScaleSetName string,
|
|
|
|
options *armcomputev2.VirtualMachineScaleSetsClientGetOptions,
|
|
|
|
) (armcomputev2.VirtualMachineScaleSetsClientGetResponse, error)
|
2022-03-22 11:03:15 -04:00
|
|
|
BeginCreateOrUpdate(ctx context.Context, resourceGroupName string,
|
2022-07-27 16:02:33 -04:00
|
|
|
vmScaleSetName string, parameters armcomputev2.VirtualMachineScaleSet,
|
|
|
|
options *armcomputev2.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions) (
|
|
|
|
*runtime.Poller[armcomputev2.VirtualMachineScaleSetsClientCreateOrUpdateResponse], error)
|
2022-03-22 11:03:15 -04:00
|
|
|
}
|
|
|
|
|
2022-09-06 04:05:51 -04:00
|
|
|
type virtualMachineScaleSetVMsAPI interface {
|
|
|
|
GetInstanceView(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string,
|
|
|
|
options *armcomputev2.VirtualMachineScaleSetVMsClientGetInstanceViewOptions,
|
|
|
|
) (armcomputev2.VirtualMachineScaleSetVMsClientGetInstanceViewResponse, error)
|
|
|
|
}
|
|
|
|
|
2022-03-22 11:03:15 -04:00
|
|
|
type publicIPAddressesAPI interface {
|
2022-07-27 16:02:33 -04:00
|
|
|
NewListVirtualMachineScaleSetVMPublicIPAddressesPager(
|
|
|
|
resourceGroupName string, virtualMachineScaleSetName string,
|
|
|
|
virtualmachineIndex string, networkInterfaceName string,
|
|
|
|
ipConfigurationName string,
|
2022-03-22 11:03:15 -04:00
|
|
|
options *armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesOptions,
|
2022-07-27 16:02:33 -04:00
|
|
|
) *runtime.Pager[armnetwork.PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse]
|
2022-03-22 11:03:15 -04:00
|
|
|
BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPAddressName string,
|
|
|
|
parameters armnetwork.PublicIPAddress, options *armnetwork.PublicIPAddressesClientBeginCreateOrUpdateOptions) (
|
2022-07-27 16:02:33 -04:00
|
|
|
*runtime.Poller[armnetwork.PublicIPAddressesClientCreateOrUpdateResponse], error)
|
2022-03-22 11:03:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type networkInterfacesAPI interface {
|
|
|
|
GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string,
|
|
|
|
virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string,
|
|
|
|
options *armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions,
|
|
|
|
) (armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse, error)
|
|
|
|
}
|
|
|
|
|
2022-08-25 09:12:08 -04:00
|
|
|
type resourceAPI interface {
|
|
|
|
NewListByResourceGroupPager(resourceGroupName string,
|
|
|
|
options *armresources.ClientListByResourceGroupOptions,
|
|
|
|
) *runtime.Pager[armresources.ClientListByResourceGroupResponse]
|
|
|
|
BeginDeleteByID(ctx context.Context, resourceID string, apiVersion string,
|
|
|
|
options *armresources.ClientBeginDeleteByIDOptions,
|
|
|
|
) (*runtime.Poller[armresources.ClientDeleteByIDResponse], error)
|
2022-03-22 11:03:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type applicationsAPI interface {
|
|
|
|
Create(ctx context.Context, parameters graphrbac.ApplicationCreateParameters) (graphrbac.Application, error)
|
|
|
|
Delete(ctx context.Context, applicationObjectID string) (autorest.Response, error)
|
|
|
|
UpdatePasswordCredentials(ctx context.Context, objectID string, parameters graphrbac.PasswordCredentialsUpdateParameters) (autorest.Response, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type servicePrincipalsAPI interface {
|
|
|
|
Create(ctx context.Context, parameters graphrbac.ServicePrincipalCreateParameters) (graphrbac.ServicePrincipal, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// the newer version "armauthorization.RoleAssignmentsClient" is currently broken: https://github.com/Azure/azure-sdk-for-go/issues/17071
|
|
|
|
// TODO: switch to "armauthorization.RoleAssignmentsClient" if issue is resolved.
|
|
|
|
type roleAssignmentsAPI interface {
|
|
|
|
Create(ctx context.Context, scope string, roleAssignmentName string, parameters authorization.RoleAssignmentCreateParameters) (authorization.RoleAssignment, error)
|
|
|
|
}
|
|
|
|
|
2022-06-10 07:18:30 -04:00
|
|
|
type applicationInsightsAPI interface {
|
|
|
|
CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, insightProperties armapplicationinsights.Component,
|
|
|
|
options *armapplicationinsights.ComponentsClientCreateOrUpdateOptions) (armapplicationinsights.ComponentsClientCreateOrUpdateResponse, error)
|
|
|
|
}
|