moc-sdk-for-go/pkg/client/cloud.go

102 строки
3.8 KiB
Go
Исходник Обычный вид История

2020-07-14 03:02:41 +03:00
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache v2.0 License.
package client
import (
log "k8s.io/klog"
2020-09-08 23:04:05 +03:00
"github.com/microsoft/moc/pkg/auth"
cloud_pb "github.com/microsoft/moc/rpc/cloudagent/cloud"
2020-07-14 03:02:41 +03:00
)
// GetLocationClient returns the virtual machine client to comminicate with the wssd agent
func GetLocationClient(serverAddress *string, authorizer auth.Authorizer) (cloud_pb.LocationAgentClient, error) {
conn, err := getClientConnection(serverAddress, authorizer)
if err != nil {
log.Fatalf("Unable to get LocationClient. Failed to dial: %v", err)
}
return cloud_pb.NewLocationAgentClient(conn), nil
}
// GetGroupClient returns the virtual machine client to comminicate with the wssd agent
func GetGroupClient(serverAddress *string, authorizer auth.Authorizer) (cloud_pb.GroupAgentClient, error) {
conn, err := getClientConnection(serverAddress, authorizer)
if err != nil {
log.Fatalf("Unable to get GroupClient. Failed to dial: %v", err)
}
return cloud_pb.NewGroupAgentClient(conn), nil
}
// GetNodeClient returns the virtual machine client to comminicate with the wssd agent
func GetNodeClient(serverAddress *string, authorizer auth.Authorizer) (cloud_pb.NodeAgentClient, error) {
conn, err := getClientConnection(serverAddress, authorizer)
if err != nil {
log.Fatalf("Unable to get NodeClient. Failed to dial: %v", err)
}
return cloud_pb.NewNodeAgentClient(conn), nil
}
// GetKubernetesClient returns the virtual machine client to comminicate with the wssd agent
func GetKubernetesClient(serverAddress *string, authorizer auth.Authorizer) (cloud_pb.KubernetesAgentClient, error) {
conn, err := getClientConnection(serverAddress, authorizer)
if err != nil {
log.Fatalf("Unable to get KubernetesClient. Failed to dial: %v", err)
}
return cloud_pb.NewKubernetesAgentClient(conn), nil
}
// GetClusterClient returns the cluster client to communicate with the wssd agent
func GetClusterClient(serverAddress *string, authorizer auth.Authorizer) (cloud_pb.ClusterAgentClient, error) {
conn, err := getClientConnection(serverAddress, authorizer)
if err != nil {
log.Fatalf("Unable to get ClusterClient. Failed to dial: %v", err)
}
return cloud_pb.NewClusterAgentClient(conn), nil
}
// GetControlPlaneClient returns the cluster client to communicate with the wssd agent
func GetControlPlaneClient(serverAddress *string, authorizer auth.Authorizer) (cloud_pb.ControlPlaneAgentClient, error) {
conn, err := getClientConnection(serverAddress, authorizer)
if err != nil {
log.Fatalf("Unable to get ControlPlaneClient. Failed to dial: %v", err)
}
return cloud_pb.NewControlPlaneAgentClient(conn), nil
}
added moc sdk changes for availability zone (#252) * added moc sdk changes for availability zone * update variable name * updated moc package version in go mod * updated the moc test package version * Updating method name * experimental changes * moved av zone to cloud * removed some vm references * removed some vm references * moved code to cloud.go * updates few methods * removed unnecessary lines * removed unnecessary lines * removed extra space * added extra space * updates nodes * removed av zone validation in CreateorUpdate * testing changes * testing changes * testing changes * testing changes * testing changes * testing changes * testing changes * added location check * added location check * added location check * added location to avzone obj * added changes to fix version * removed type * updated variable names * updated properties field * updated name to zone * updated text * Revert "updated moc tag" This reverts commit 4f563cbc1df1a69aa70cc10507dc860aec90cf13, reversing changes made to aec867f04b94c2fe33aebe4fef38178c5a665d25. * updated moc tag * updated moc tag * fixed build error * Revert "fixed build error" This reverts commit bb7c24ff4d5c37f47ab9cba85445e5a90f5238e9. * Revert "updated moc tag" This reverts commit d457b99bf2c3427582614f2b0c7cfe61e03ec5e0. * updated moc tag to 121 * updated moc tag to 122 * added back the removed replace dependency * added back the removed replace dependency * updated latest moc tag * updated go * reverted new dependencies * updated moc tag * resolved buid error * resolved build error * restore go mod and go sum * update go mod * update go mod * updated latest moc tag * updated a comment * added nil checks for location and properties
2024-08-23 23:44:16 +03:00
// GetZone returns the availability zone client to communicate with the wssd agent
func GetZoneClient(serverAddress *string, authorizer auth.Authorizer) (cloud_pb.ZoneAgentClient, error) {
conn, err := getClientConnection(serverAddress, authorizer)
if err != nil {
log.Fatalf("Unable to get ZoneClient. Failed to dial: %v", err)
}
return cloud_pb.NewZoneAgentClient(conn), nil
}
// GetEtcdClusterClient returns the cluster client to communicate with the wssd agent
func GetEtcdClusterClient(serverAddress *string, authorizer auth.Authorizer) (cloud_pb.EtcdClusterAgentClient, error) {
conn, err := getClientConnection(serverAddress, authorizer)
if err != nil {
log.Fatalf("Unable to get EtcdClusterClient. Failed to dial: %v", err)
}
return cloud_pb.NewEtcdClusterAgentClient(conn), nil
}
// GetEtcdServerClient returns the server client to communicate with the wssd agent
func GetEtcdServerClient(serverAddress *string, authorizer auth.Authorizer) (cloud_pb.EtcdServerAgentClient, error) {
conn, err := getClientConnection(serverAddress, authorizer)
if err != nil {
log.Fatalf("Unable to get EtcdServerClient. Failed to dial: %v", err)
}
return cloud_pb.NewEtcdServerAgentClient(conn), nil
}