armwindowsesu

package module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 14 Imported by: 1

README

Azure Windows ESU Module for Go

PkgGoDev

The armwindowsesu module provides operations for working with Azure Windows ESU.

Source code

Getting started

Prerequisites

  • an Azure subscription
  • Go 1.18 or above (You could download and install the latest version of Go from here. It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this doc.)

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Windows ESU module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsesu/armwindowsesu

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Windows ESU. The azidentity module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.

cred, err := azidentity.NewDefaultAzureCredential(nil)

For more information on authentication, please see the documentation for azidentity at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity.

Client Factory

Azure Windows ESU module consists of one or more clients. We provide a client factory which could be used to create any client in this module.

clientFactory, err := armwindowsesu.NewClientFactory(<subscription ID>, cred, nil)

You can use ClientOptions in package github.com/Azure/azure-sdk-for-go/sdk/azcore/arm to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for azcore at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore.

options := arm.ClientOptions {
    ClientOptions: azcore.ClientOptions {
        Cloud: cloud.AzureChina,
    },
}
clientFactory, err := armwindowsesu.NewClientFactory(<subscription ID>, cred, &options)

Clients

A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory.

client := clientFactory.NewMultipleActivationKeysClient()

Fakes

The fake package contains types used for constructing in-memory fake servers used in unit tests. This allows writing tests to cover various success/error conditions without the need for connecting to a live service.

Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes.

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Windows ESU label.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientFactory added in v0.6.0

type ClientFactory struct {
	// contains filtered or unexported fields
}

ClientFactory is a client factory used to create any client in this module. Don't use this type directly, use NewClientFactory instead.

func NewClientFactory added in v0.6.0

func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error)

NewClientFactory creates a new instance of ClientFactory with the specified values. The parameter values will be propagated to any client created from this factory.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewMultipleActivationKeysClient added in v0.6.0

func (c *ClientFactory) NewMultipleActivationKeysClient() *MultipleActivationKeysClient

NewMultipleActivationKeysClient creates a new instance of MultipleActivationKeysClient.

func (*ClientFactory) NewOperationsClient added in v0.6.0

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

type ErrorDefinition

type ErrorDefinition struct {
	// READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code.
	Code *string

	// READ-ONLY; Internal error details.
	Details []*ErrorDefinition

	// READ-ONLY; Description of the error.
	Message *string
}

ErrorDefinition - Error definition.

func (ErrorDefinition) MarshalJSON

func (e ErrorDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorDefinition.

func (*ErrorDefinition) UnmarshalJSON added in v0.6.0

func (e *ErrorDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinition.

type ErrorResponse

type ErrorResponse struct {
	// The error details.
	Error *ErrorDefinition
}

ErrorResponse - Error response.

func (ErrorResponse) MarshalJSON added in v0.6.0

func (e ErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorResponse.

func (*ErrorResponse) UnmarshalJSON added in v0.6.0

func (e *ErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse.

type MultipleActivationKey

type MultipleActivationKey struct {
	// REQUIRED; The geo-location where the resource lives
	Location *string

	// MAK key specific properties.
	Properties *MultipleActivationKeyProperties

	// Resource tags.
	Tags map[string]*string

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

MultipleActivationKey - MAK key details.

func (MultipleActivationKey) MarshalJSON

func (m MultipleActivationKey) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MultipleActivationKey.

func (*MultipleActivationKey) UnmarshalJSON added in v0.6.0

func (m *MultipleActivationKey) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MultipleActivationKey.

type MultipleActivationKeyList

type MultipleActivationKeyList struct {
	// List of MAK keys.
	Value []*MultipleActivationKey

	// READ-ONLY; Link to the next page of resources.
	NextLink *string
}

MultipleActivationKeyList - List of MAK keys.

func (MultipleActivationKeyList) MarshalJSON

func (m MultipleActivationKeyList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MultipleActivationKeyList.

func (*MultipleActivationKeyList) UnmarshalJSON added in v0.6.0

func (m *MultipleActivationKeyList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MultipleActivationKeyList.

type MultipleActivationKeyProperties

type MultipleActivationKeyProperties struct {
	// Agreement number under which the key is requested.
	AgreementNumber *string

	// Number of activations/servers using the MAK key.
	InstalledServerNumber *int32

	// true if user has eligible on-premises Windows physical or virtual machines, and that the requested key will only be used
	// in their organization; false otherwise.
	IsEligible *bool

	// Type of OS for which the key is requested.
	OSType *OsType

	// Type of support
	SupportType *SupportType

	// READ-ONLY; End of support of security updates activated by the MAK key.
	ExpirationDate *time.Time

	// READ-ONLY; MAK 5x5 key.
	MultipleActivationKey *string

	// READ-ONLY
	ProvisioningState *ProvisioningState
}

MultipleActivationKeyProperties - MAK key specific properties.

func (MultipleActivationKeyProperties) MarshalJSON

func (m MultipleActivationKeyProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MultipleActivationKeyProperties.

func (*MultipleActivationKeyProperties) UnmarshalJSON

func (m *MultipleActivationKeyProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MultipleActivationKeyProperties.

type MultipleActivationKeyUpdate

type MultipleActivationKeyUpdate struct {
	// Resource tags.
	Tags map[string]*string
}

MultipleActivationKeyUpdate - MAK key details.

func (MultipleActivationKeyUpdate) MarshalJSON

func (m MultipleActivationKeyUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MultipleActivationKeyUpdate.

func (*MultipleActivationKeyUpdate) UnmarshalJSON added in v0.6.0

func (m *MultipleActivationKeyUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MultipleActivationKeyUpdate.

type MultipleActivationKeysClient

type MultipleActivationKeysClient struct {
	// contains filtered or unexported fields
}

MultipleActivationKeysClient contains the methods for the MultipleActivationKeys group. Don't use this type directly, use NewMultipleActivationKeysClient() instead.

func NewMultipleActivationKeysClient

func NewMultipleActivationKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MultipleActivationKeysClient, error)

NewMultipleActivationKeysClient creates a new instance of MultipleActivationKeysClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*MultipleActivationKeysClient) BeginCreate

func (client *MultipleActivationKeysClient) BeginCreate(ctx context.Context, resourceGroupName string, multipleActivationKeyName string, multipleActivationKey MultipleActivationKey, options *MultipleActivationKeysClientBeginCreateOptions) (*runtime.Poller[MultipleActivationKeysClientCreateResponse], error)

BeginCreate - Create a MAK key. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2019-09-16-preview

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • multipleActivationKeyName - The name of the MAK key.
  • multipleActivationKey - Details of the MAK key.
  • options - MultipleActivationKeysClientBeginCreateOptions contains the optional parameters for the MultipleActivationKeysClient.BeginCreate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/CreateMultipleActivationKey.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsesu/armwindowsesu"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armwindowsesu.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewMultipleActivationKeysClient().BeginCreate(ctx, "testgr1", "server08-key-2019", armwindowsesu.MultipleActivationKey{
		Location: to.Ptr("East US"),
		Properties: &armwindowsesu.MultipleActivationKeyProperties{
			AgreementNumber:       to.Ptr("1a2b45ag"),
			InstalledServerNumber: to.Ptr[int32](100),
			IsEligible:            to.Ptr(true),
			OSType:                to.Ptr(armwindowsesu.OsTypeWindowsServer2008),
			SupportType:           to.Ptr(armwindowsesu.SupportTypeSupplementalServicing),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.MultipleActivationKey = armwindowsesu.MultipleActivationKey{
	// 	Name: to.Ptr("server08-key-2019"),
	// 	Type: to.Ptr("Microsoft.WindowsESU/multipleActivationKeys"),
	// 	ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testgr1/providers/Microsoft.WindowsESU/multipleActivationKeys/server08-key-2019"),
	// 	Location: to.Ptr("East US"),
	// 	Properties: &armwindowsesu.MultipleActivationKeyProperties{
	// 		AgreementNumber: to.Ptr("1a2b45ag"),
	// 		ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-21T21:12:26.000Z"); return t}()),
	// 		InstalledServerNumber: to.Ptr[int32](100),
	// 		IsEligible: to.Ptr(true),
	// 		MultipleActivationKey: to.Ptr("aaaaa-bbbbb-ccccc-ddddd-eeeee"),
	// 		OSType: to.Ptr(armwindowsesu.OsTypeWindowsServer2008),
	// 		ProvisioningState: to.Ptr(armwindowsesu.ProvisioningStateSucceeded),
	// 		SupportType: to.Ptr(armwindowsesu.SupportTypeSupplementalServicing),
	// 	},
	// }
}
Output:

func (*MultipleActivationKeysClient) Delete

func (client *MultipleActivationKeysClient) Delete(ctx context.Context, resourceGroupName string, multipleActivationKeyName string, options *MultipleActivationKeysClientDeleteOptions) (MultipleActivationKeysClientDeleteResponse, error)

Delete - Delete a MAK key. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2019-09-16-preview

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • multipleActivationKeyName - The name of the MAK key.
  • options - MultipleActivationKeysClientDeleteOptions contains the optional parameters for the MultipleActivationKeysClient.Delete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/DeleteMultipleActivationKey.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsesu/armwindowsesu"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armwindowsesu.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewMultipleActivationKeysClient().Delete(ctx, "testgr1", "server08-key-2019", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*MultipleActivationKeysClient) Get

func (client *MultipleActivationKeysClient) Get(ctx context.Context, resourceGroupName string, multipleActivationKeyName string, options *MultipleActivationKeysClientGetOptions) (MultipleActivationKeysClientGetResponse, error)

Get - Get a MAK key. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2019-09-16-preview

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • multipleActivationKeyName - The name of the MAK key.
  • options - MultipleActivationKeysClientGetOptions contains the optional parameters for the MultipleActivationKeysClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/GetMultipleActivationKey.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsesu/armwindowsesu"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armwindowsesu.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewMultipleActivationKeysClient().Get(ctx, "testgr1", "server08-key-2019", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.MultipleActivationKey = armwindowsesu.MultipleActivationKey{
	// 	Name: to.Ptr("server08-key-2019"),
	// 	Type: to.Ptr("Microsoft.WindowsESU/multipleActivationKeys"),
	// 	ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testgr1/providers/Microsoft.WindowsESU/multipleActivationKeys/server08-key-2019"),
	// 	Location: to.Ptr("East US"),
	// 	Properties: &armwindowsesu.MultipleActivationKeyProperties{
	// 		AgreementNumber: to.Ptr("1a2b45ag"),
	// 		ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-21T21:12:26.000Z"); return t}()),
	// 		InstalledServerNumber: to.Ptr[int32](100),
	// 		IsEligible: to.Ptr(true),
	// 		MultipleActivationKey: to.Ptr("aaaaa-bbbbb-ccccc-ddddd-eeeee"),
	// 		OSType: to.Ptr(armwindowsesu.OsTypeWindowsServer2008),
	// 		ProvisioningState: to.Ptr(armwindowsesu.ProvisioningStateSucceeded),
	// 		SupportType: to.Ptr(armwindowsesu.SupportTypeSupplementalServicing),
	// 	},
	// }
}
Output:

func (*MultipleActivationKeysClient) NewListByResourceGroupPager added in v0.4.0

NewListByResourceGroupPager - List all Multiple Activation Keys (MAK) in a resource group.

Generated from API version 2019-09-16-preview

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - MultipleActivationKeysClientListByResourceGroupOptions contains the optional parameters for the MultipleActivationKeysClient.NewListByResourceGroupPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/ListMultipleActivationKeysByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsesu/armwindowsesu"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armwindowsesu.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewMultipleActivationKeysClient().NewListByResourceGroupPager("testrg1", nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.MultipleActivationKeyList = armwindowsesu.MultipleActivationKeyList{
		// 	Value: []*armwindowsesu.MultipleActivationKey{
		// 		{
		// 			Name: to.Ptr("server08-key-2019"),
		// 			Type: to.Ptr("Microsoft.WindowsESU/multipleActivationKeys"),
		// 			ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg1/providers/Microsoft.WindowsESU/multipleActivationKeys/server08-key-2019"),
		// 			Location: to.Ptr("East US"),
		// 			Properties: &armwindowsesu.MultipleActivationKeyProperties{
		// 				AgreementNumber: to.Ptr("1a2b45ag"),
		// 				ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-21T21:12:26.000Z"); return t}()),
		// 				InstalledServerNumber: to.Ptr[int32](100),
		// 				IsEligible: to.Ptr(true),
		// 				MultipleActivationKey: to.Ptr("aaaaa-bbbbb-ccccc-ddddd-eeeee"),
		// 				OSType: to.Ptr(armwindowsesu.OsTypeWindowsServer2008),
		// 				ProvisioningState: to.Ptr(armwindowsesu.ProvisioningStateSucceeded),
		// 				SupportType: to.Ptr(armwindowsesu.SupportTypeSupplementalServicing),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("server08r2-key-2019"),
		// 			Type: to.Ptr("Microsoft.WindowsESU/multipleActivationKeys"),
		// 			ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg1/providers/Microsoft.WindowsESU/multipleActivationKeys/server08r2-key-2019"),
		// 			Location: to.Ptr("East US"),
		// 			Properties: &armwindowsesu.MultipleActivationKeyProperties{
		// 				AgreementNumber: to.Ptr("1a2b45ag"),
		// 				ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-01T10:33:09.000Z"); return t}()),
		// 				InstalledServerNumber: to.Ptr[int32](100),
		// 				IsEligible: to.Ptr(true),
		// 				MultipleActivationKey: to.Ptr("aaaaa-bbbbb-ccccc-ddddd-eeeee"),
		// 				OSType: to.Ptr(armwindowsesu.OsTypeWindowsServer2008R2),
		// 				ProvisioningState: to.Ptr(armwindowsesu.ProvisioningStateSucceeded),
		// 				SupportType: to.Ptr(armwindowsesu.SupportTypeSupplementalServicing),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*MultipleActivationKeysClient) NewListPager added in v0.4.0

NewListPager - List all Multiple Activation Keys (MAK) created for a subscription.

Generated from API version 2019-09-16-preview

  • options - MultipleActivationKeysClientListOptions contains the optional parameters for the MultipleActivationKeysClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/ListMultipleActivationKeys.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsesu/armwindowsesu"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armwindowsesu.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewMultipleActivationKeysClient().NewListPager(nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.MultipleActivationKeyList = armwindowsesu.MultipleActivationKeyList{
		// 	Value: []*armwindowsesu.MultipleActivationKey{
		// 		{
		// 			Name: to.Ptr("server08-key-2019"),
		// 			Type: to.Ptr("Microsoft.WindowsESU/multipleActivationKeys"),
		// 			ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg1/providers/Microsoft.WindowsESU/multipleActivationKeys/server08-key-2019"),
		// 			Location: to.Ptr("East US"),
		// 			Properties: &armwindowsesu.MultipleActivationKeyProperties{
		// 				AgreementNumber: to.Ptr("1a2b45ag"),
		// 				ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-21T21:12:26.000Z"); return t}()),
		// 				InstalledServerNumber: to.Ptr[int32](100),
		// 				IsEligible: to.Ptr(true),
		// 				MultipleActivationKey: to.Ptr("aaaaa-bbbbb-ccccc-ddddd-eeeee"),
		// 				OSType: to.Ptr(armwindowsesu.OsTypeWindowsServer2008),
		// 				ProvisioningState: to.Ptr(armwindowsesu.ProvisioningStateSucceeded),
		// 				SupportType: to.Ptr(armwindowsesu.SupportTypeSupplementalServicing),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("server08r2-key-2019"),
		// 			Type: to.Ptr("Microsoft.WindowsESU/multipleActivationKeys"),
		// 			ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg1/providers/Microsoft.WindowsESU/multipleActivationKeys/server08r2-key-2019"),
		// 			Location: to.Ptr("East US"),
		// 			Properties: &armwindowsesu.MultipleActivationKeyProperties{
		// 				AgreementNumber: to.Ptr("1a2b45ag"),
		// 				ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-01T10:33:09.000Z"); return t}()),
		// 				InstalledServerNumber: to.Ptr[int32](100),
		// 				IsEligible: to.Ptr(true),
		// 				MultipleActivationKey: to.Ptr("aaaaa-bbbbb-ccccc-ddddd-eeeee"),
		// 				OSType: to.Ptr(armwindowsesu.OsTypeWindowsServer2008R2),
		// 				ProvisioningState: to.Ptr(armwindowsesu.ProvisioningStateSucceeded),
		// 				SupportType: to.Ptr(armwindowsesu.SupportTypeSupplementalServicing),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*MultipleActivationKeysClient) Update

func (client *MultipleActivationKeysClient) Update(ctx context.Context, resourceGroupName string, multipleActivationKeyName string, multipleActivationKey MultipleActivationKeyUpdate, options *MultipleActivationKeysClientUpdateOptions) (MultipleActivationKeysClientUpdateResponse, error)

Update - Update a MAK key. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2019-09-16-preview

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • multipleActivationKeyName - The name of the MAK key.
  • multipleActivationKey - Details of the MAK key.
  • options - MultipleActivationKeysClientUpdateOptions contains the optional parameters for the MultipleActivationKeysClient.Update method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/UpdateMultipleActivationKey.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsesu/armwindowsesu"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armwindowsesu.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewMultipleActivationKeysClient().Update(ctx, "testgr1", "server08-key-2019", armwindowsesu.MultipleActivationKeyUpdate{
		Tags: map[string]*string{
			"tag1": to.Ptr("value1"),
			"tag2": to.Ptr("value2"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.MultipleActivationKey = armwindowsesu.MultipleActivationKey{
	// 	Name: to.Ptr("server08-key-2019"),
	// 	Type: to.Ptr("Microsoft.WindowsESU/multipleActivationKeys"),
	// 	ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testgr1/providers/Microsoft.WindowsESU/multipleActivationKeys/server08-key-2019"),
	// 	Location: to.Ptr("East US"),
	// 	Tags: map[string]*string{
	// 		"tag1": to.Ptr("value1"),
	// 		"tag2": to.Ptr("value2"),
	// 	},
	// 	Properties: &armwindowsesu.MultipleActivationKeyProperties{
	// 		AgreementNumber: to.Ptr("1a2b45ag"),
	// 		ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-21T21:12:26.000Z"); return t}()),
	// 		InstalledServerNumber: to.Ptr[int32](100),
	// 		IsEligible: to.Ptr(true),
	// 		MultipleActivationKey: to.Ptr("aaaaa-bbbbb-ccccc-ddddd-eeeee"),
	// 		OSType: to.Ptr(armwindowsesu.OsTypeWindowsServer2008),
	// 		ProvisioningState: to.Ptr(armwindowsesu.ProvisioningStateSucceeded),
	// 		SupportType: to.Ptr(armwindowsesu.SupportTypeSupplementalServicing),
	// 	},
	// }
}
Output:

type MultipleActivationKeysClientBeginCreateOptions added in v0.2.0

type MultipleActivationKeysClientBeginCreateOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

MultipleActivationKeysClientBeginCreateOptions contains the optional parameters for the MultipleActivationKeysClient.BeginCreate method.

type MultipleActivationKeysClientCreateResponse added in v0.2.0

type MultipleActivationKeysClientCreateResponse struct {
	// MAK key details.
	MultipleActivationKey
}

MultipleActivationKeysClientCreateResponse contains the response from method MultipleActivationKeysClient.BeginCreate.

type MultipleActivationKeysClientDeleteOptions added in v0.2.0

type MultipleActivationKeysClientDeleteOptions struct {
}

MultipleActivationKeysClientDeleteOptions contains the optional parameters for the MultipleActivationKeysClient.Delete method.

type MultipleActivationKeysClientDeleteResponse added in v0.2.0

type MultipleActivationKeysClientDeleteResponse struct {
}

MultipleActivationKeysClientDeleteResponse contains the response from method MultipleActivationKeysClient.Delete.

type MultipleActivationKeysClientGetOptions added in v0.2.0

type MultipleActivationKeysClientGetOptions struct {
}

MultipleActivationKeysClientGetOptions contains the optional parameters for the MultipleActivationKeysClient.Get method.

type MultipleActivationKeysClientGetResponse added in v0.2.0

type MultipleActivationKeysClientGetResponse struct {
	// MAK key details.
	MultipleActivationKey
}

MultipleActivationKeysClientGetResponse contains the response from method MultipleActivationKeysClient.Get.

type MultipleActivationKeysClientListByResourceGroupOptions added in v0.2.0

type MultipleActivationKeysClientListByResourceGroupOptions struct {
}

MultipleActivationKeysClientListByResourceGroupOptions contains the optional parameters for the MultipleActivationKeysClient.NewListByResourceGroupPager method.

type MultipleActivationKeysClientListByResourceGroupResponse added in v0.2.0

type MultipleActivationKeysClientListByResourceGroupResponse struct {
	// List of MAK keys.
	MultipleActivationKeyList
}

MultipleActivationKeysClientListByResourceGroupResponse contains the response from method MultipleActivationKeysClient.NewListByResourceGroupPager.

type MultipleActivationKeysClientListOptions added in v0.2.0

type MultipleActivationKeysClientListOptions struct {
}

MultipleActivationKeysClientListOptions contains the optional parameters for the MultipleActivationKeysClient.NewListPager method.

type MultipleActivationKeysClientListResponse added in v0.2.0

type MultipleActivationKeysClientListResponse struct {
	// List of MAK keys.
	MultipleActivationKeyList
}

MultipleActivationKeysClientListResponse contains the response from method MultipleActivationKeysClient.NewListPager.

type MultipleActivationKeysClientUpdateOptions added in v0.2.0

type MultipleActivationKeysClientUpdateOptions struct {
}

MultipleActivationKeysClientUpdateOptions contains the optional parameters for the MultipleActivationKeysClient.Update method.

type MultipleActivationKeysClientUpdateResponse added in v0.2.0

type MultipleActivationKeysClientUpdateResponse struct {
	// MAK key details.
	MultipleActivationKey
}

MultipleActivationKeysClientUpdateResponse contains the response from method MultipleActivationKeysClient.Update.

type Operation

type Operation struct {
	// Meta data about operation used for display in portal.
	Display *OperationDisplay

	// READ-ONLY; Name of the operation.
	Name *string
}

Operation - REST API operation details.

func (Operation) MarshalJSON added in v0.6.0

func (o Operation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON added in v0.6.0

func (o *Operation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Operation.

type OperationDisplay

type OperationDisplay struct {
	Description *string
	Operation   *string
	Provider    *string
	Resource    *string
}

OperationDisplay - Meta data about operation used for display in portal.

func (OperationDisplay) MarshalJSON added in v0.6.0

func (o OperationDisplay) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationDisplay.

func (*OperationDisplay) UnmarshalJSON added in v0.6.0

func (o *OperationDisplay) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.

type OperationList

type OperationList struct {
	// List of operations.
	Value []*Operation

	// READ-ONLY; Link to the next page of resources.
	NextLink *string
}

OperationList - List of available REST API operations.

func (OperationList) MarshalJSON

func (o OperationList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationList.

func (*OperationList) UnmarshalJSON added in v0.6.0

func (o *OperationList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationList.

type OperationsClient

type OperationsClient struct {
	// contains filtered or unexported fields
}

OperationsClient contains the methods for the Operations group. Don't use this type directly, use NewOperationsClient() instead.

func NewOperationsClient

func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error)

NewOperationsClient creates a new instance of OperationsClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*OperationsClient) NewListPager added in v0.4.0

NewListPager - List all available Windows.ESU provider operations.

Generated from API version 2019-09-16-preview

  • options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/ListOperations.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsesu/armwindowsesu"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armwindowsesu.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewOperationsClient().NewListPager(nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.OperationList = armwindowsesu.OperationList{
		// 	Value: []*armwindowsesu.Operation{
		// 		{
		// 			Name: to.Ptr("Microsoft.WindowsESU/multipleActivationKeys/Read"),
		// 			Display: &armwindowsesu.OperationDisplay{
		// 				Description: to.Ptr("List MAK keys."),
		// 				Operation: to.Ptr("List MAK keys"),
		// 				Provider: to.Ptr("Microsoft Windows Extended Security Updates"),
		// 				Resource: to.Ptr("multipleActivationKey"),
		// 			},
		// 	}},
		// }
	}
}
Output:

type OperationsClientListOptions added in v0.2.0

type OperationsClientListOptions struct {
}

OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.

type OperationsClientListResponse added in v0.2.0

type OperationsClientListResponse struct {
	// List of available REST API operations.
	OperationList
}

OperationsClientListResponse contains the response from method OperationsClient.NewListPager.

type OsType

type OsType string

OsType - Type of OS for which the key is requested.

const (
	OsTypeWindows7            OsType = "Windows7"
	OsTypeWindowsServer2008   OsType = "WindowsServer2008"
	OsTypeWindowsServer2008R2 OsType = "WindowsServer2008R2"
)

func PossibleOsTypeValues

func PossibleOsTypeValues() []OsType

PossibleOsTypeValues returns the possible values for the OsType const type.

type ProvisioningState

type ProvisioningState string
const (
	ProvisioningStateAccepted     ProvisioningState = "Accepted"
	ProvisioningStateCanceled     ProvisioningState = "Canceled"
	ProvisioningStateFailed       ProvisioningState = "Failed"
	ProvisioningStateProvisioning ProvisioningState = "Provisioning"
	ProvisioningStateSucceeded    ProvisioningState = "Succeeded"
)

func PossibleProvisioningStateValues

func PossibleProvisioningStateValues() []ProvisioningState

PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type.

type Resource

type Resource struct {
	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

Resource - Common fields that are returned in the response for all Azure Resource Manager resources

func (Resource) MarshalJSON

func (r Resource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Resource.

func (*Resource) UnmarshalJSON added in v0.6.0

func (r *Resource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Resource.

type SupportType

type SupportType string

SupportType - Type of support

const (
	SupportTypePremiumAssurance      SupportType = "PremiumAssurance"
	SupportTypeSupplementalServicing SupportType = "SupplementalServicing"
)

func PossibleSupportTypeValues

func PossibleSupportTypeValues() []SupportType

PossibleSupportTypeValues returns the possible values for the SupportType const type.

type TrackedResource

type TrackedResource struct {
	// REQUIRED; The geo-location where the resource lives
	Location *string

	// Resource tags.
	Tags map[string]*string

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'

func (TrackedResource) MarshalJSON

func (t TrackedResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TrackedResource.

func (*TrackedResource) UnmarshalJSON added in v0.6.0

func (t *TrackedResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL