Exemple #1
0
// NewClient constructs an ExtensionsClient.
func NewClient(mgtURL string, subscriptionID string, cert []byte) (ExtensionsClient, error) {
	cfg := management.DefaultConfig()
	cfg.APIVersion = apiVersion
	cfg.ManagementURL = mgtURL
	cl, err := management.NewClientFromConfig(subscriptionID, cert, cfg)
	return ExtensionsClient{cl}, err
}
Exemple #2
0
func newMachine(bm *provider.BaseMachine) (provider.Machine, error) {
	m := &Machine{BaseMachine: bm}
	cred := m.Cred()

	c, err := management.ClientFromPublishSettingsDataWithConfig([]byte(cred.PublishSettings), cred.SubscriptionID, management.DefaultConfig())
	if err != nil {
		return nil, err
	}

	vmclient := vm.NewClient(c)

	m.AzureClient = c
	m.AzureVMClient = &vmclient

	return m, nil
}