armmanagementpartner

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 Management Partner Module for Go

PkgGoDev

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

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 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.

Client Factory

Azure Management Partner 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 := armmanagementpartner.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 := armmanagementpartner.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.NewPartnerClient()

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 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 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(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.

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

func (*ClientFactory) NewOperationClient added in v0.6.0

func (c *ClientFactory) NewOperationClient() *OperationClient

NewOperationClient creates a new instance of OperationClient.

func (*ClientFactory) NewPartnerClient added in v0.6.0

func (c *ClientFactory) NewPartnerClient() *PartnerClient

NewPartnerClient creates a new instance of PartnerClient.

func (*ClientFactory) NewPartnersClient added in v0.6.0

func (c *ClientFactory) NewPartnersClient() *PartnersClient

NewPartnersClient creates a new instance of PartnersClient.

type Error

type Error struct {
	// this is the error response code
	Code *string

	// this is the ExtendedErrorInfo property
	Error *ExtendedErrorInfo

	// this is the extended error info message
	Message *string
}

Error - this is the management partner operations error

func (Error) MarshalJSON added in v0.6.0

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

MarshalJSON implements the json.Marshaller interface for type Error.

func (*Error) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Error.

type ExtendedErrorInfo

type ExtendedErrorInfo struct {
	// this is the error response code
	Code *string

	// this is the extended error info message
	Message *string
}

ExtendedErrorInfo - this is the extended error info

func (ExtendedErrorInfo) MarshalJSON added in v0.6.0

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

MarshalJSON implements the json.Marshaller interface for type ExtendedErrorInfo.

func (*ExtendedErrorInfo) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedErrorInfo.

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.

Generated from API version 2018-02-01

  • options - OperationClientListOptions contains the optional parameters for the OperationClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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()
	clientFactory, err := armmanagementpartner.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewOperationClient().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 = armmanagementpartner.OperationList{
		// 	Value: []*armmanagementpartner.OperationResponse{
		// 		{
		// 			Name: to.Ptr("Microsoft.ManagementPartner/partners/read"),
		// 			Display: &armmanagementpartner.OperationDisplay{
		// 				Description: to.Ptr("Read All ManagementPartner"),
		// 				Operation: to.Ptr("Get ManagementPartner"),
		// 				Provider: to.Ptr("Microsoft ManagementPartner"),
		// 				Resource: to.Ptr("ManagementPartner"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.ManagementPartner/partners/write"),
		// 			Display: &armmanagementpartner.OperationDisplay{
		// 				Description: to.Ptr("Create any ManagementPartner"),
		// 				Operation: to.Ptr("Create ManagementPartner"),
		// 				Provider: to.Ptr("Microsoft ManagementPartner"),
		// 				Resource: to.Ptr("ManagementPartner"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.ManagementPartner/partners/action"),
		// 			Display: &armmanagementpartner.OperationDisplay{
		// 				Description: to.Ptr("Update any ManagementPartner"),
		// 				Operation: to.Ptr("Update ManagementPartner"),
		// 				Provider: to.Ptr("Microsoft ManagementPartner"),
		// 				Resource: to.Ptr("ManagementPartner"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.ManagementPartner/partners/delete"),
		// 			Display: &armmanagementpartner.OperationDisplay{
		// 				Description: to.Ptr("Delete any ManagementPartner"),
		// 				Operation: to.Ptr("Delete ManagementPartner"),
		// 				Provider: to.Ptr("Microsoft ManagementPartner"),
		// 				Resource: to.Ptr("ManagementPartner"),
		// 			},
		// 	}},
		// }
	}
}
Output:

type OperationClientListOptions added in v0.2.0

type OperationClientListOptions struct {
}

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

type OperationClientListResponse added in v0.2.0

type OperationClientListResponse struct {
	// this is the management partner operations list
	OperationList
}

OperationClientListResponse contains the response from method OperationClient.NewListPager.

type OperationDisplay

type OperationDisplay struct {
	// the is management partner operation description
	Description *string

	// the is management partner operation
	Operation *string

	// the is management partner provider
	Provider *string

	// the is management partner resource
	Resource *string
}

OperationDisplay - this is the management partner operation

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 {
	// Url to get the next page of items.
	NextLink *string

	// this is the operation response list
	Value []*OperationResponse
}

OperationList - this is the management partner operations list

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 OperationResponse

type OperationResponse struct {
	// this is the operation display
	Display *OperationDisplay

	// this is the operation response name
	Name *string

	// the is operation response origin information
	Origin *string
}

OperationResponse - this is the management partner operations response

func (OperationResponse) MarshalJSON added in v0.6.0

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

MarshalJSON implements the json.Marshaller interface for type OperationResponse.

func (*OperationResponse) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationResponse.

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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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()
	clientFactory, err := armmanagementpartner.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewPartnerClient().Create(ctx, "123456", 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.PartnerResponse = armmanagementpartner.PartnerResponse{
	// 	Name: to.Ptr("123456"),
	// 	Type: to.Ptr("Microsoft.ManagementPartner/partner"),
	// 	Etag: to.Ptr[int32](3),
	// 	ID: to.Ptr("/providers/microsoft.managementpartner/partners/123456"),
	// 	Properties: &armmanagementpartner.PartnerProperties{
	// 		CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-20T01:23:40.528Z"); return t}()),
	// 		ObjectID: to.Ptr("aa67f786-0552-423e-8849-244ed12bf581"),
	// 		PartnerID: to.Ptr("123456"),
	// 		PartnerName: to.Ptr("Test_jefl"),
	// 		State: to.Ptr(armmanagementpartner.ManagementPartnerStateActive),
	// 		TenantID: to.Ptr("1b1121dd-6900-412a-af73-e8d44f81e1c1"),
	// 		UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-20T01:52:57.912Z"); return t}()),
	// 		Version: to.Ptr[int32](3),
	// 	},
	// }
}
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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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()
	clientFactory, err := armmanagementpartner.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewPartnerClient().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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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()
	clientFactory, err := armmanagementpartner.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewPartnerClient().Get(ctx, "123456", 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.PartnerResponse = armmanagementpartner.PartnerResponse{
	// 	Name: to.Ptr("123456"),
	// 	Type: to.Ptr("Microsoft.ManagementPartner/partner"),
	// 	Etag: to.Ptr[int32](3),
	// 	ID: to.Ptr("/providers/microsoft.managementpartner/partners/123456"),
	// 	Properties: &armmanagementpartner.PartnerProperties{
	// 		CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-20T01:23:40.528Z"); return t}()),
	// 		ObjectID: to.Ptr("aa67f786-0552-423e-8849-244ed12bf581"),
	// 		PartnerID: to.Ptr("123456"),
	// 		PartnerName: to.Ptr("Test_jefl"),
	// 		State: to.Ptr(armmanagementpartner.ManagementPartnerStateActive),
	// 		TenantID: to.Ptr("1b1121dd-6900-412a-af73-e8d44f81e1c1"),
	// 		UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-20T01:52:57.912Z"); return t}()),
	// 		Version: to.Ptr[int32](3),
	// 	},
	// }
}
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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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()
	clientFactory, err := armmanagementpartner.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewPartnerClient().Update(ctx, "123456", 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.PartnerResponse = armmanagementpartner.PartnerResponse{
	// 	Name: to.Ptr("123456"),
	// 	Type: to.Ptr("Microsoft.ManagementPartner/partner"),
	// 	Etag: to.Ptr[int32](3),
	// 	ID: to.Ptr("/providers/microsoft.managementpartner/partners/123456"),
	// 	Properties: &armmanagementpartner.PartnerProperties{
	// 		CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-20T01:23:40.528Z"); return t}()),
	// 		ObjectID: to.Ptr("aa67f786-0552-423e-8849-244ed12bf581"),
	// 		PartnerID: to.Ptr("123456"),
	// 		PartnerName: to.Ptr("Test_jefl"),
	// 		State: to.Ptr(armmanagementpartner.ManagementPartnerStateActive),
	// 		TenantID: to.Ptr("1b1121dd-6900-412a-af73-e8d44f81e1c1"),
	// 		UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-20T01:52:57.912Z"); return t}()),
	// 		Version: to.Ptr[int32](3),
	// 	},
	// }
}
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 {
	// this is the management partner operations response
	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 {
	// this is the management partner operations response
	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 {
	// this is the management partner operations response
	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

	// This is the object id.
	ObjectID *string

	// This is the partner id
	PartnerID *string

	// This is the partner name
	PartnerName *string

	// This is the partner state
	State *ManagementPartnerState

	// This is the tenant id.
	TenantID *string

	// This is the DateTime when the partner was updated.
	UpdatedTime *time.Time

	// This is the version.
	Version *int32
}

PartnerProperties - this is the management partner properties

func (PartnerProperties) MarshalJSON

func (p PartnerProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PartnerProperties.

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

	// Properties of the partner
	Properties *PartnerProperties

	// READ-ONLY; Identifier of the partner
	ID *string

	// READ-ONLY; Name of the partner
	Name *string

	// READ-ONLY; Type of resource. "Microsoft.ManagementPartner/partners"
	Type *string
}

PartnerResponse - this is the management partner operations response

func (PartnerResponse) MarshalJSON added in v0.6.0

func (p PartnerResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PartnerResponse.

func (*PartnerResponse) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type PartnerResponse.

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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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()
	clientFactory, err := armmanagementpartner.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewPartnersClient().Get(ctx, 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.PartnerResponse = armmanagementpartner.PartnerResponse{
	// 	Name: to.Ptr("123456"),
	// 	Type: to.Ptr("Microsoft.ManagementPartner/partner"),
	// 	Etag: to.Ptr[int32](3),
	// 	ID: to.Ptr("/providers/microsoft.managementpartner/partners"),
	// 	Properties: &armmanagementpartner.PartnerProperties{
	// 		CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-20T01:23:40.528Z"); return t}()),
	// 		ObjectID: to.Ptr("aa67f786-0552-423e-8849-244ed12bf581"),
	// 		PartnerID: to.Ptr("123456"),
	// 		PartnerName: to.Ptr("Test_jefl"),
	// 		State: to.Ptr(armmanagementpartner.ManagementPartnerStateActive),
	// 		TenantID: to.Ptr("1b1121dd-6900-412a-af73-e8d44f81e1c1"),
	// 		UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-20T01:52:57.912Z"); return t}()),
	// 		Version: to.Ptr[int32](3),
	// 	},
	// }
}
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 {
	// this is the management partner operations response
	PartnerResponse
}

PartnersClientGetResponse contains the response from method PartnersClient.Get.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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