armmanagementpartner

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 16 Imported by: 1

README

Azure Management Partner Module for Go

PkgGoDev

The armmanagementpartner module provides operations for working with Azure Management Partner.

Source code

Getting started

Prerequisites

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Management Partner module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Management Partner. 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.

Clients

Azure Management Partner modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential.

client, err := armmanagementpartner.NewPartnerClient(<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,
    },
}
client, err := armmanagementpartner.NewPartnerClient(<subscription ID>, cred, &options)

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Management Partner 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 Error

type Error struct {
	// this is the error response code
	Code *string `json:"code,omitempty"`

	// this is the ExtendedErrorInfo property
	Error *ExtendedErrorInfo `json:"error,omitempty"`

	// this is the extended error info message
	Message *string `json:"message,omitempty"`
}

Error - this is the management partner operations error

type ExtendedErrorInfo

type ExtendedErrorInfo struct {
	// this is the error response code
	Code *string `json:"code,omitempty"`

	// this is the extended error info message
	Message *string `json:"message,omitempty"`
}

ExtendedErrorInfo - this is the extended error info

type ManagementPartnerState

type ManagementPartnerState string

ManagementPartnerState - this is the management partner state: Active or Deleted

const (
	ManagementPartnerStateActive  ManagementPartnerState = "Active"
	ManagementPartnerStateDeleted ManagementPartnerState = "Deleted"
)

func PossibleManagementPartnerStateValues

func PossibleManagementPartnerStateValues() []ManagementPartnerState

PossibleManagementPartnerStateValues returns the possible values for the ManagementPartnerState const type.

type OperationClient

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

OperationClient contains the methods for the Operation group. Don't use this type directly, use NewOperationClient() instead.

func NewOperationClient

func NewOperationClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationClient, error)

NewOperationClient creates a new instance of OperationClient with the specified values. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*OperationClient) NewListPager added in v0.4.0

NewListPager - List all the operations. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2018-02-01 options - OperationClientListOptions contains the optional parameters for the OperationClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armmanagementpartner.NewOperationClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager(nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

type OperationClientListOptions added in v0.2.0

type OperationClientListOptions struct {
}

OperationClientListOptions contains the optional parameters for the OperationClient.List method.

type OperationClientListResponse added in v0.2.0

type OperationClientListResponse struct {
	OperationList
}

OperationClientListResponse contains the response from method OperationClient.List.

type OperationDisplay

type OperationDisplay struct {
	// the is management partner operation description
	Description *string `json:"description,omitempty"`

	// the is management partner operation
	Operation *string `json:"operation,omitempty"`

	// the is management partner provider
	Provider *string `json:"provider,omitempty"`

	// the is management partner resource
	Resource *string `json:"resource,omitempty"`
}

OperationDisplay - this is the management partner operation

type OperationList

type OperationList struct {
	// Url to get the next page of items.
	NextLink *string `json:"nextLink,omitempty"`

	// this is the operation response list
	Value []*OperationResponse `json:"value,omitempty"`
}

OperationList - this is the management partner operations list

type OperationResponse

type OperationResponse struct {
	// this is the operation display
	Display *OperationDisplay `json:"display,omitempty"`

	// this is the operation response name
	Name *string `json:"name,omitempty"`

	// the is operation response origin information
	Origin *string `json:"origin,omitempty"`
}

OperationResponse - this is the management partner operations response

type PartnerClient

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

PartnerClient contains the methods for the Partner group. Don't use this type directly, use NewPartnerClient() instead.

func NewPartnerClient

func NewPartnerClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PartnerClient, error)

NewPartnerClient creates a new instance of PartnerClient with the specified values. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*PartnerClient) Create

Create - Create a management partner for the objectId and tenantId. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2018-02-01 partnerID - Id of the Partner options - PartnerClientCreateOptions contains the optional parameters for the PartnerClient.Create method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armmanagementpartner.NewPartnerClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Create(ctx,
		"123456",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PartnerClient) Delete

Delete - Delete the management partner for the objectId and tenantId. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2018-02-01 partnerID - Id of the Partner options - PartnerClientDeleteOptions contains the optional parameters for the PartnerClient.Delete method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armmanagementpartner.NewPartnerClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = client.Delete(ctx,
		"123456",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*PartnerClient) Get

Get - Get the management partner using the partnerId, objectId and tenantId. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2018-02-01 partnerID - Id of the Partner options - PartnerClientGetOptions contains the optional parameters for the PartnerClient.Get method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetails.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armmanagementpartner.NewPartnerClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		"123456",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PartnerClient) Update

Update - Update the management partner for the objectId and tenantId. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2018-02-01 partnerID - Id of the Partner options - PartnerClientUpdateOptions contains the optional parameters for the PartnerClient.Update method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armmanagementpartner.NewPartnerClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Update(ctx,
		"123456",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

type PartnerClientCreateOptions added in v0.2.0

type PartnerClientCreateOptions struct {
}

PartnerClientCreateOptions contains the optional parameters for the PartnerClient.Create method.

type PartnerClientCreateResponse added in v0.2.0

type PartnerClientCreateResponse struct {
	PartnerResponse
}

PartnerClientCreateResponse contains the response from method PartnerClient.Create.

type PartnerClientDeleteOptions added in v0.2.0

type PartnerClientDeleteOptions struct {
}

PartnerClientDeleteOptions contains the optional parameters for the PartnerClient.Delete method.

type PartnerClientDeleteResponse added in v0.2.0

type PartnerClientDeleteResponse struct {
}

PartnerClientDeleteResponse contains the response from method PartnerClient.Delete.

type PartnerClientGetOptions added in v0.2.0

type PartnerClientGetOptions struct {
}

PartnerClientGetOptions contains the optional parameters for the PartnerClient.Get method.

type PartnerClientGetResponse added in v0.2.0

type PartnerClientGetResponse struct {
	PartnerResponse
}

PartnerClientGetResponse contains the response from method PartnerClient.Get.

type PartnerClientUpdateOptions added in v0.2.0

type PartnerClientUpdateOptions struct {
}

PartnerClientUpdateOptions contains the optional parameters for the PartnerClient.Update method.

type PartnerClientUpdateResponse added in v0.2.0

type PartnerClientUpdateResponse struct {
	PartnerResponse
}

PartnerClientUpdateResponse contains the response from method PartnerClient.Update.

type PartnerProperties

type PartnerProperties struct {
	// This is the DateTime when the partner was created.
	CreatedTime *time.Time `json:"createdTime,omitempty"`

	// This is the object id.
	ObjectID *string `json:"objectId,omitempty"`

	// This is the partner id
	PartnerID *string `json:"partnerId,omitempty"`

	// This is the partner name
	PartnerName *string `json:"partnerName,omitempty"`

	// This is the partner state
	State *ManagementPartnerState `json:"state,omitempty"`

	// This is the tenant id.
	TenantID *string `json:"tenantId,omitempty"`

	// This is the DateTime when the partner was updated.
	UpdatedTime *time.Time `json:"updatedTime,omitempty"`

	// This is the version.
	Version *int32 `json:"version,omitempty"`
}

PartnerProperties - this is the management partner properties

func (*PartnerProperties) UnmarshalJSON

func (p *PartnerProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PartnerProperties.

type PartnerResponse

type PartnerResponse struct {
	// Type of the partner
	Etag *int32 `json:"etag,omitempty"`

	// Properties of the partner
	Properties *PartnerProperties `json:"properties,omitempty"`

	// READ-ONLY; Identifier of the partner
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; Name of the partner
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; Type of resource. "Microsoft.ManagementPartner/partners"
	Type *string `json:"type,omitempty" azure:"ro"`
}

PartnerResponse - this is the management partner operations response

type PartnersClient

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

PartnersClient contains the methods for the Partners group. Don't use this type directly, use NewPartnersClient() instead.

func NewPartnersClient

func NewPartnersClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PartnersClient, error)

NewPartnersClient creates a new instance of PartnersClient with the specified values. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*PartnersClient) Get

Get - Get the management partner using the objectId and tenantId. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2018-02-01 options - PartnersClientGetOptions contains the optional parameters for the PartnersClient.Get method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armmanagementpartner.NewPartnersClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

type PartnersClientGetOptions added in v0.2.0

type PartnersClientGetOptions struct {
}

PartnersClientGetOptions contains the optional parameters for the PartnersClient.Get method.

type PartnersClientGetResponse added in v0.2.0

type PartnersClientGetResponse struct {
	PartnerResponse
}

PartnersClientGetResponse contains the response from method PartnersClient.Get.

Jump to

Keyboard shortcuts

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