armgraphservices

package module
v0.1.0 Latest Latest
Warning

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

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

README

Azure Graphservices Module for Go

PkgGoDev

The armgraphservices module provides operations for working with Azure Graphservices.

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 Graphservices module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/graphservices/armgraphservices

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Graphservices. 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 Graphservices 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 := armgraphservices.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 := armgraphservices.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.NewAccountClient()

Provide Feedback

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

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

AccountClient contains the methods for the Account group. Don't use this type directly, use NewAccountClient() instead.

func NewAccountClient

func NewAccountClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountClient, error)

NewAccountClient creates a new instance of AccountClient 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 (*AccountClient) BeginCreateAndUpdate

func (client *AccountClient) BeginCreateAndUpdate(ctx context.Context, resourceGroupName string, resourceName string, accountResource AccountResource, options *AccountClientBeginCreateAndUpdateOptions) (*runtime.Poller[AccountClientCreateAndUpdateResponse], error)

BeginCreateAndUpdate - Create or update account resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-09-22-preview

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the resource.
  • accountResource - Account details.
  • options - AccountClientBeginCreateAndUpdateOptions contains the optional parameters for the AccountClient.BeginCreateAndUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Create.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/graphservices/armgraphservices"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armgraphservices.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewAccountClient().BeginCreateAndUpdate(ctx, "testResourceGroupGRAM", "11111111-aaaa-1111-bbbb-1111111111111", armgraphservices.AccountResource{
		Tags: map[string]*string{
			"tag1": to.Ptr("value1"),
			"tag2": to.Ptr("value2"),
		},
		Properties: &armgraphservices.AccountResourceProperties{
			AppID: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
		},
	}, 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.AccountResource = armgraphservices.AccountResource{
	// 	Name: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
	// 	Type: to.Ptr("Microsoft.GraphServices/accounts"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroupGRAM/providers/Microsoft.GraphServices/accounts/11111111-aaaa-1111-bbbb-111111111111"),
	// 	Tags: map[string]*string{
	// 		"tag1": to.Ptr("value1"),
	// 		"tag2": to.Ptr("value2"),
	// 	},
	// 	Properties: &armgraphservices.AccountResourceProperties{
	// 		AppID: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
	// 		BillingPlanID: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
	// 		ProvisioningState: to.Ptr(armgraphservices.ProvisioningStateSucceeded),
	// 	},
	// }
}
Output:

func (*AccountClient) Delete

func (client *AccountClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *AccountClientDeleteOptions) (AccountClientDeleteResponse, error)

Delete - Deletes a account resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-09-22-preview

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the resource.
  • options - AccountClientDeleteOptions contains the optional parameters for the AccountClient.Delete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/graphservices/armgraphservices"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armgraphservices.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAccountClient().Delete(ctx, "testResourceGroupGRAM", "11111111-aaaa-1111-bbbb-111111111111", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*AccountClient) Get

func (client *AccountClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *AccountClientGetOptions) (AccountClientGetResponse, error)

Get - Returns account resource for a given name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-09-22-preview

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the resource.
  • options - AccountClientGetOptions contains the optional parameters for the AccountClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/graphservices/armgraphservices"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armgraphservices.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAccountClient().Get(ctx, "testResourceGroupGRAM", "11111111-aaaa-1111-bbbb-111111111111", 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.AccountResource = armgraphservices.AccountResource{
	// 	Name: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
	// 	Type: to.Ptr("Microsoft.GraphServices/accounts"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroupGRAM/providers/Microsoft.GraphServices/accounts/11111111-aaaa-1111-bbbb-111111111111"),
	// 	Tags: map[string]*string{
	// 		"tag1": to.Ptr("value1"),
	// 		"tag2": to.Ptr("value2"),
	// 	},
	// 	Properties: &armgraphservices.AccountResourceProperties{
	// 		AppID: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
	// 		ProvisioningState: to.Ptr(armgraphservices.ProvisioningStateSucceeded),
	// 	},
	// }
}
Output:

func (*AccountClient) Update

func (client *AccountClient) Update(ctx context.Context, resourceGroupName string, resourceName string, accountResource AccountPatchResource, options *AccountClientUpdateOptions) (AccountClientUpdateResponse, error)

Update - Update account details. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-09-22-preview

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the resource.
  • accountResource - Account patch details.
  • options - AccountClientUpdateOptions contains the optional parameters for the AccountClient.Update method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Update.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/graphservices/armgraphservices"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armgraphservices.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAccountClient().Update(ctx, "testResourceGroupGRAM", "11111111-aaaa-1111-bbbb-111111111111", armgraphservices.AccountPatchResource{
		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.AccountResource = armgraphservices.AccountResource{
	// 	Name: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
	// 	Type: to.Ptr("Microsoft.GraphServices/accounts"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroupGRAM/providers/Microsoft.GraphServices/accounts/11111111-aaaa-1111-bbbb-111111111111"),
	// 	Tags: map[string]*string{
	// 		"tag1": to.Ptr("value1"),
	// 		"tag2": to.Ptr("value2"),
	// 	},
	// 	Properties: &armgraphservices.AccountResourceProperties{
	// 		AppID: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
	// 		BillingPlanID: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
	// 		ProvisioningState: to.Ptr(armgraphservices.ProvisioningStateSucceeded),
	// 	},
	// }
}
Output:

type AccountClientBeginCreateAndUpdateOptions

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

AccountClientBeginCreateAndUpdateOptions contains the optional parameters for the AccountClient.BeginCreateAndUpdate method.

type AccountClientCreateAndUpdateResponse

type AccountClientCreateAndUpdateResponse struct {
	AccountResource
}

AccountClientCreateAndUpdateResponse contains the response from method AccountClient.BeginCreateAndUpdate.

type AccountClientDeleteOptions

type AccountClientDeleteOptions struct {
}

AccountClientDeleteOptions contains the optional parameters for the AccountClient.Delete method.

type AccountClientDeleteResponse

type AccountClientDeleteResponse struct {
}

AccountClientDeleteResponse contains the response from method AccountClient.Delete.

type AccountClientGetOptions

type AccountClientGetOptions struct {
}

AccountClientGetOptions contains the optional parameters for the AccountClient.Get method.

type AccountClientGetResponse

type AccountClientGetResponse struct {
	AccountResource
}

AccountClientGetResponse contains the response from method AccountClient.Get.

type AccountClientUpdateOptions

type AccountClientUpdateOptions struct {
}

AccountClientUpdateOptions contains the optional parameters for the AccountClient.Update method.

type AccountClientUpdateResponse

type AccountClientUpdateResponse struct {
	AccountResource
}

AccountClientUpdateResponse contains the response from method AccountClient.Update.

type AccountPatchResource

type AccountPatchResource struct {
	// List of key value pairs that describe the resource. This will overwrite the existing tags.
	Tags map[string]*string `json:"tags,omitempty"`
}

AccountPatchResource - Account patch properties

func (AccountPatchResource) MarshalJSON

func (a AccountPatchResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AccountPatchResource.

func (*AccountPatchResource) UnmarshalJSON

func (a *AccountPatchResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AccountPatchResource.

type AccountResource

type AccountResource struct {
	// REQUIRED; Property bag from billing account
	Properties *AccountResourceProperties `json:"properties,omitempty"`

	// Location of the resource.
	Location *string `json:"location,omitempty"`

	// resource tags.
	Tags map[string]*string `json:"tags,omitempty"`

	// READ-ONLY; Azure resource ID.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; Azure resource name.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; Metadata pertaining to creation and last modification of the resource.
	SystemData *AccountResourceSystemData `json:"systemData,omitempty" azure:"ro"`

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

AccountResource - Account details

func (AccountResource) MarshalJSON

func (a AccountResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AccountResource.

func (*AccountResource) UnmarshalJSON

func (a *AccountResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AccountResource.

type AccountResourceList

type AccountResourceList struct {
	// The link to the next page of items
	NextLink *string `json:"nextLink,omitempty"`

	// The list of recommendations.
	Value []*AccountResource `json:"value,omitempty"`
}

AccountResourceList - The list of accounts.

func (AccountResourceList) MarshalJSON

func (a AccountResourceList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AccountResourceList.

func (*AccountResourceList) UnmarshalJSON

func (a *AccountResourceList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AccountResourceList.

type AccountResourceProperties

type AccountResourceProperties struct {
	// REQUIRED; Customer owned application ID
	AppID *string `json:"appId,omitempty"`

	// READ-ONLY; Billing Plan Id
	BillingPlanID *string `json:"billingPlanId,omitempty" azure:"ro"`

	// READ-ONLY; Provisioning state.
	ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"`
}

AccountResourceProperties - Property bag from billing account

func (AccountResourceProperties) MarshalJSON

func (a AccountResourceProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AccountResourceProperties.

func (*AccountResourceProperties) UnmarshalJSON

func (a *AccountResourceProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AccountResourceProperties.

type AccountResourceSystemData

type AccountResourceSystemData struct {
	// The timestamp of resource creation (UTC).
	CreatedAt *time.Time `json:"createdAt,omitempty"`

	// The type of identity that created the resource.
	CreatedByType *CreatedByType `json:"createdByType,omitempty"`

	// The timestamp of resource last modification (UTC)
	LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"`

	// The type of identity that last modified the resource.
	LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"`
}

AccountResourceSystemData - Metadata pertaining to creation and last modification of the resource.

func (AccountResourceSystemData) MarshalJSON

func (a AccountResourceSystemData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AccountResourceSystemData.

func (*AccountResourceSystemData) UnmarshalJSON

func (a *AccountResourceSystemData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AccountResourceSystemData.

type AccountsClient

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

AccountsClient contains the methods for the Accounts group. Don't use this type directly, use NewAccountsClient() instead.

func NewAccountsClient

func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountsClient, error)

NewAccountsClient creates a new instance of AccountsClient 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 (*AccountsClient) NewListByResourceGroupPager

func (client *AccountsClient) NewListByResourceGroupPager(resourceGroupName string, options *AccountsClientListByResourceGroupOptions) *runtime.Pager[AccountsClientListByResourceGroupResponse]

NewListByResourceGroupPager - Returns list of accounts apps.

Generated from API version 2022-09-22-preview

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

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/graphservices/armgraphservices"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armgraphservices.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAccountsClient().NewListByResourceGroupPager("testResourceGroupGRAM", 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.AccountResourceList = armgraphservices.AccountResourceList{
		// 	Value: []*armgraphservices.AccountResource{
		// 		{
		// 			Name: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
		// 			Type: to.Ptr("Microsoft.GraphServices/accounts"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroupGRAM/providers/Microsoft.GraphServices/accounts/11111111-aaaa-1111-bbbb-111111111111"),
		// 			Tags: map[string]*string{
		// 				"tag1": to.Ptr("value1"),
		// 				"tag2": to.Ptr("value2"),
		// 			},
		// 			Properties: &armgraphservices.AccountResourceProperties{
		// 				AppID: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
		// 				ProvisioningState: to.Ptr(armgraphservices.ProvisioningStateSucceeded),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*AccountsClient) NewListBySubscriptionPager

NewListBySubscriptionPager - Returns list of accounts belonging to a subscription.

Generated from API version 2022-09-22-preview

  • options - AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.NewListBySubscriptionPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_List_Sub.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/graphservices/armgraphservices"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armgraphservices.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAccountsClient().NewListBySubscriptionPager(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.AccountResourceList = armgraphservices.AccountResourceList{
		// 	Value: []*armgraphservices.AccountResource{
		// 		{
		// 			Name: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
		// 			Type: to.Ptr("Microsoft.GraphServices/accounts"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroupGRAM/providers/Microsoft.GraphServices/accounts/11111111-aaaa-1111-bbbb-111111111111"),
		// 			Tags: map[string]*string{
		// 				"tag1": to.Ptr("value1"),
		// 				"tag2": to.Ptr("value2"),
		// 			},
		// 			Properties: &armgraphservices.AccountResourceProperties{
		// 				AppID: to.Ptr("11111111-aaaa-1111-bbbb-111111111111"),
		// 				ProvisioningState: to.Ptr(armgraphservices.ProvisioningStateSucceeded),
		// 			},
		// 	}},
		// }
	}
}
Output:

type AccountsClientListByResourceGroupOptions

type AccountsClientListByResourceGroupOptions struct {
}

AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager method.

type AccountsClientListByResourceGroupResponse

type AccountsClientListByResourceGroupResponse struct {
	AccountResourceList
}

AccountsClientListByResourceGroupResponse contains the response from method AccountsClient.NewListByResourceGroupPager.

type AccountsClientListBySubscriptionOptions

type AccountsClientListBySubscriptionOptions struct {
}

AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.NewListBySubscriptionPager method.

type AccountsClientListBySubscriptionResponse

type AccountsClientListBySubscriptionResponse struct {
	AccountResourceList
}

AccountsClientListBySubscriptionResponse contains the response from method AccountsClient.NewListBySubscriptionPager.

type ActionType

type ActionType string

ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.

const (
	ActionTypeInternal ActionType = "Internal"
)

func PossibleActionTypeValues

func PossibleActionTypeValues() []ActionType

PossibleActionTypeValues returns the possible values for the ActionType const type.

type ClientFactory

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

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) NewAccountClient

func (c *ClientFactory) NewAccountClient() *AccountClient

func (*ClientFactory) NewAccountsClient

func (c *ClientFactory) NewAccountsClient() *AccountsClient

func (*ClientFactory) NewOperationClient

func (c *ClientFactory) NewOperationClient() *OperationClient

type CreatedByType

type CreatedByType string

CreatedByType - The type of identity that created the resource.

const (
	CreatedByTypeApplication     CreatedByType = "Application"
	CreatedByTypeKey             CreatedByType = "Key"
	CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity"
	CreatedByTypeUser            CreatedByType = "User"
)

func PossibleCreatedByTypeValues

func PossibleCreatedByTypeValues() []CreatedByType

PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.

type Operation

type Operation struct {
	// Localized display information for this particular operation.
	Display *OperationDisplay `json:"display,omitempty"`

	// READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
	ActionType *ActionType `json:"actionType,omitempty" azure:"ro"`

	// READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane
	// operations.
	IsDataAction *bool `json:"isDataAction,omitempty" azure:"ro"`

	// READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write",
	// "Microsoft.Compute/virtualMachines/capture/action"
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default
	// value is "user,system"
	Origin *Origin `json:"origin,omitempty" azure:"ro"`
}

Operation - Details of a REST API operation, returned from the Resource Provider Operations API

func (Operation) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type Operation.

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

NewListPager - Returns list of operations.

Generated from API version 2022-09-22-preview

  • 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/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Operations_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/graphservices/armgraphservices"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armgraphservices.NewClientFactory("<subscription-id>", 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.OperationListResult = armgraphservices.OperationListResult{
		// 	Value: []*armgraphservices.Operation{
		// 		{
		// 			Name: to.Ptr("Microsoft.GraphServices/accounts/read"),
		// 			Display: &armgraphservices.OperationDisplay{
		// 				Description: to.Ptr("Get Microsoft Graph Services Account resources"),
		// 				Operation: to.Ptr("Get Microsoft Graph Services Account resources"),
		// 				Provider: to.Ptr("Microsoft Graph Services"),
		// 				Resource: to.Ptr("Microsoft Graph Services Account"),
		// 			},
		// 	}},
		// }
	}
}
Output:

type OperationClientListOptions

type OperationClientListOptions struct {
}

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

type OperationClientListResponse

type OperationClientListResponse struct {
	OperationListResult
}

OperationClientListResponse contains the response from method OperationClient.NewListPager.

type OperationDisplay

type OperationDisplay struct {
	// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views.
	Description *string `json:"description,omitempty" azure:"ro"`

	// READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual
	// Machine", "Restart Virtual Machine".
	Operation *string `json:"operation,omitempty" azure:"ro"`

	// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft
	// Compute".
	Provider *string `json:"provider,omitempty" azure:"ro"`

	// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job
	// Schedule Collections".
	Resource *string `json:"resource,omitempty" azure:"ro"`
}

OperationDisplay - Localized display information for this particular operation.

func (OperationDisplay) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OperationDisplay.

func (*OperationDisplay) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.

type OperationListResult

type OperationListResult struct {
	// READ-ONLY; URL to get the next set of operation list results (if there are any).
	NextLink *string `json:"nextLink,omitempty" azure:"ro"`

	// READ-ONLY; List of operations supported by the resource provider
	Value []*Operation `json:"value,omitempty" azure:"ro"`
}

OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.

func (OperationListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OperationListResult.

func (*OperationListResult) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.

type Origin

type Origin string

Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system"

const (
	OriginSystem     Origin = "system"
	OriginUser       Origin = "user"
	OriginUserSystem Origin = "user,system"
)

func PossibleOriginValues

func PossibleOriginValues() []Origin

PossibleOriginValues returns the possible values for the Origin const type.

type ProvisioningState

type ProvisioningState string

ProvisioningState - Provisioning state.

const (
	ProvisioningStateCanceled  ProvisioningState = "Canceled"
	ProvisioningStateFailed    ProvisioningState = "Failed"
	ProvisioningStateSucceeded ProvisioningState = "Succeeded"
)

func PossibleProvisioningStateValues

func PossibleProvisioningStateValues() []ProvisioningState

PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type.

Jump to

Keyboard shortcuts

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