armcommunication

package module
v1.0.0 Latest Latest
Warning

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

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

README

Azure Communication Services Module for Go

PkgGoDev

The armcommunication module provides operations for working with Azure Communication Services.

Source code

Getting started

Prerequisites

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Communication Services module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communication/armcommunication

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Communication Services. 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 Communication Services 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 := armcommunication.NewServiceClient(<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 := armcommunication.NewServiceClient(<subscription ID>, cred, &options)

Provide Feedback

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

type ErrorAdditionalInfo struct {
	// READ-ONLY; The additional info.
	Info interface{} `json:"info,omitempty" azure:"ro"`

	// READ-ONLY; The additional info type.
	Type *string `json:"type,omitempty" azure:"ro"`
}

ErrorAdditionalInfo - The resource management error additional info.

type ErrorDetail

type ErrorDetail struct {
	// READ-ONLY; The error additional info.
	AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"`

	// READ-ONLY; The error code.
	Code *string `json:"code,omitempty" azure:"ro"`

	// READ-ONLY; The error details.
	Details []*ErrorDetail `json:"details,omitempty" azure:"ro"`

	// READ-ONLY; The error message.
	Message *string `json:"message,omitempty" azure:"ro"`

	// READ-ONLY; The error target.
	Target *string `json:"target,omitempty" azure:"ro"`
}

ErrorDetail - The error detail.

type ErrorResponse

type ErrorResponse struct {
	// The error object.
	Error *ErrorDetail `json:"error,omitempty"`
}

ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).

type KeyType

type KeyType string

KeyType - The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive).

const (
	KeyTypePrimary   KeyType = "Primary"
	KeyTypeSecondary KeyType = "Secondary"
)

func PossibleKeyTypeValues

func PossibleKeyTypeValues() []KeyType

PossibleKeyTypeValues returns the possible values for the KeyType const type.

type LinkNotificationHubParameters

type LinkNotificationHubParameters struct {
	// REQUIRED; Connection string for the notification hub
	ConnectionString *string `json:"connectionString,omitempty"`

	// REQUIRED; The resource ID of the notification hub
	ResourceID *string `json:"resourceId,omitempty"`
}

LinkNotificationHubParameters - Description of an Azure Notification Hub to link to the communication service

type LinkedNotificationHub

type LinkedNotificationHub struct {
	// The resource ID of the notification hub
	ResourceID *string `json:"resourceId,omitempty"`
}

LinkedNotificationHub - A notification hub that has been linked to the communication service

type LocationResource

type LocationResource struct {
	// The Azure location where the CommunicationService is running.
	Location *string `json:"location,omitempty"`
}

LocationResource - An ARM resource with its own location (not a global or an inherited location).

type NameAvailability

type NameAvailability struct {
	// The message of the operation.
	Message *string `json:"message,omitempty"`

	// Indicates whether the name is available or not.
	NameAvailable *bool `json:"nameAvailable,omitempty"`

	// The reason of the availability. Required if name is not available.
	Reason *string `json:"reason,omitempty"`
}

NameAvailability - Result of the request to check name availability. It contains a flag and possible reason of failure.

type NameAvailabilityParameters

type NameAvailabilityParameters struct {
	// REQUIRED; The CommunicationService name to validate. e.g."my-CommunicationService-name-here"
	Name *string `json:"name,omitempty"`

	// REQUIRED; The resource type. Should be always "Microsoft.Communication/CommunicationServices".
	Type *string `json:"type,omitempty"`
}

NameAvailabilityParameters - Data POST-ed to the nameAvailability action

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

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.

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.

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 - Lists all of the available REST API operations of the Microsoft.Communication provider. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-08-20 options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method.

type OperationsClientListOptions added in v0.2.0

type OperationsClientListOptions struct {
}

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

type OperationsClientListResponse added in v0.2.0

type OperationsClientListResponse struct {
	OperationListResult
}

OperationsClientListResponse contains the response from method OperationsClient.List.

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 of the resource.

const (
	ProvisioningStateCanceled  ProvisioningState = "Canceled"
	ProvisioningStateCreating  ProvisioningState = "Creating"
	ProvisioningStateDeleting  ProvisioningState = "Deleting"
	ProvisioningStateFailed    ProvisioningState = "Failed"
	ProvisioningStateMoving    ProvisioningState = "Moving"
	ProvisioningStateRunning   ProvisioningState = "Running"
	ProvisioningStateSucceeded ProvisioningState = "Succeeded"
	ProvisioningStateUnknown   ProvisioningState = "Unknown"
	ProvisioningStateUpdating  ProvisioningState = "Updating"
)

func PossibleProvisioningStateValues

func PossibleProvisioningStateValues() []ProvisioningState

PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type.

type RegenerateKeyParameters

type RegenerateKeyParameters struct {
	// The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive).
	KeyType *KeyType `json:"keyType,omitempty"`
}

RegenerateKeyParameters - Parameters describes the request to regenerate access keys

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 `json:"id,omitempty" azure:"ro"`

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

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string `json:"type,omitempty" azure:"ro"`
}

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

type ServiceClient added in v0.2.0

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

ServiceClient contains the methods for the CommunicationService group. Don't use this type directly, use NewServiceClient() instead.

func NewServiceClient added in v0.2.0

func NewServiceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceClient, error)

NewServiceClient creates a new instance of ServiceClient 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 (*ServiceClient) BeginCreateOrUpdate added in v0.2.0

func (client *ServiceClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServiceClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServiceClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create a new CommunicationService or update an existing CommunicationService. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-08-20 resourceGroupName - The name of the resource group. The name is case insensitive. communicationServiceName - The name of the CommunicationService resource. options - ServiceClientBeginCreateOrUpdateOptions contains the optional parameters for the ServiceClient.BeginCreateOrUpdate method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/createOrUpdate.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/communication/armcommunication"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armcommunication.NewServiceClient("12345", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := client.BeginCreateOrUpdate(ctx,
		"MyResourceGroup",
		"MyCommunicationResource",
		&armcommunication.ServiceClientBeginCreateOrUpdateOptions{Parameters: &armcommunication.ServiceResource{
			Location: to.Ptr("Global"),
			Properties: &armcommunication.ServiceProperties{
				DataLocation: to.Ptr("United States"),
			},
		},
		})
	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)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*ServiceClient) BeginDelete added in v0.2.0

func (client *ServiceClient) BeginDelete(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServiceClientBeginDeleteOptions) (*runtime.Poller[ServiceClientDeleteResponse], error)

BeginDelete - Operation to delete a CommunicationService. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-08-20 resourceGroupName - The name of the resource group. The name is case insensitive. communicationServiceName - The name of the CommunicationService resource. options - ServiceClientBeginDeleteOptions contains the optional parameters for the ServiceClient.BeginDelete method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/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/communication/armcommunication"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armcommunication.NewServiceClient("12345", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := client.BeginDelete(ctx,
		"MyResourceGroup",
		"MyCommunicationResource",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}
Output:

func (*ServiceClient) CheckNameAvailability added in v0.2.0

CheckNameAvailability - Checks that the CommunicationService name is valid and is not already in use. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-08-20 options - ServiceClientCheckNameAvailabilityOptions contains the optional parameters for the ServiceClient.CheckNameAvailability method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/checkNameAvailabilityAvailable.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/communication/armcommunication"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armcommunication.NewServiceClient("12345", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CheckNameAvailability(ctx,
		&armcommunication.ServiceClientCheckNameAvailabilityOptions{NameAvailabilityParameters: &armcommunication.NameAvailabilityParameters{
			Name: to.Ptr("MyCommunicationService"),
			Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
		},
		})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*ServiceClient) Get added in v0.2.0

func (client *ServiceClient) Get(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServiceClientGetOptions) (ServiceClientGetResponse, error)

Get - Get the CommunicationService and its properties. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-08-20 resourceGroupName - The name of the resource group. The name is case insensitive. communicationServiceName - The name of the CommunicationService resource. options - ServiceClientGetOptions contains the optional parameters for the ServiceClient.Get method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/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/communication/armcommunication"
)

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

func (*ServiceClient) LinkNotificationHub added in v0.2.0

func (client *ServiceClient) LinkNotificationHub(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServiceClientLinkNotificationHubOptions) (ServiceClientLinkNotificationHubResponse, error)

LinkNotificationHub - Links an Azure Notification Hub to this communication service. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-08-20 resourceGroupName - The name of the resource group. The name is case insensitive. communicationServiceName - The name of the CommunicationService resource. options - ServiceClientLinkNotificationHubOptions contains the optional parameters for the ServiceClient.LinkNotificationHub method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/linkNotificationHub.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/communication/armcommunication"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armcommunication.NewServiceClient("12345", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.LinkNotificationHub(ctx,
		"MyResourceGroup",
		"MyCommunicationResource",
		&armcommunication.ServiceClientLinkNotificationHubOptions{LinkNotificationHubParameters: &armcommunication.LinkNotificationHubParameters{
			ConnectionString: to.Ptr("Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234"),
			ResourceID:       to.Ptr("/subscriptions/12345/resourceGroups/MyOtherResourceGroup/providers/Microsoft.NotificationHubs/namespaces/MyNamespace/notificationHubs/MyHub"),
		},
		})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*ServiceClient) ListKeys added in v0.2.0

func (client *ServiceClient) ListKeys(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServiceClientListKeysOptions) (ServiceClientListKeysResponse, error)

ListKeys - Get the access keys of the CommunicationService resource. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-08-20 resourceGroupName - The name of the resource group. The name is case insensitive. communicationServiceName - The name of the CommunicationService resource. options - ServiceClientListKeysOptions contains the optional parameters for the ServiceClient.ListKeys method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/listKeys.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communication/armcommunication"
)

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

func (*ServiceClient) NewListByResourceGroupPager added in v0.4.0

func (client *ServiceClient) NewListByResourceGroupPager(resourceGroupName string, options *ServiceClientListByResourceGroupOptions) *runtime.Pager[ServiceClientListByResourceGroupResponse]

NewListByResourceGroupPager - Handles requests to list all resources in a resource group. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-08-20 resourceGroupName - The name of the resource group. The name is case insensitive. options - ServiceClientListByResourceGroupOptions contains the optional parameters for the ServiceClient.ListByResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/listByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communication/armcommunication"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armcommunication.NewServiceClient("12345", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListByResourceGroupPager("MyResourceGroup",
		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:

func (*ServiceClient) NewListBySubscriptionPager added in v0.4.0

NewListBySubscriptionPager - Handles requests to list all resources in a subscription. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-08-20 options - ServiceClientListBySubscriptionOptions contains the optional parameters for the ServiceClient.ListBySubscription method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/listBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communication/armcommunication"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armcommunication.NewServiceClient("12345", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListBySubscriptionPager(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:

func (*ServiceClient) RegenerateKey added in v0.2.0

func (client *ServiceClient) RegenerateKey(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters RegenerateKeyParameters, options *ServiceClientRegenerateKeyOptions) (ServiceClientRegenerateKeyResponse, error)

RegenerateKey - Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-08-20 resourceGroupName - The name of the resource group. The name is case insensitive. communicationServiceName - The name of the CommunicationService resource. parameters - Parameter that describes the Regenerate Key Operation. options - ServiceClientRegenerateKeyOptions contains the optional parameters for the ServiceClient.RegenerateKey method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/regenerateKey.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/communication/armcommunication"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armcommunication.NewServiceClient("12345", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.RegenerateKey(ctx,
		"MyResourceGroup",
		"MyCommunicationResource",
		armcommunication.RegenerateKeyParameters{
			KeyType: to.Ptr(armcommunication.KeyTypePrimary),
		},
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*ServiceClient) Update added in v0.2.0

func (client *ServiceClient) Update(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServiceClientUpdateOptions) (ServiceClientUpdateResponse, error)

Update - Operation to update an existing CommunicationService. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-08-20 resourceGroupName - The name of the resource group. The name is case insensitive. communicationServiceName - The name of the CommunicationService resource. options - ServiceClientUpdateOptions contains the optional parameters for the ServiceClient.Update method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/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/communication/armcommunication"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armcommunication.NewServiceClient("12345", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Update(ctx,
		"MyResourceGroup",
		"MyCommunicationResource",
		&armcommunication.ServiceClientUpdateOptions{Parameters: &armcommunication.ServiceResource{
			Tags: map[string]*string{
				"newTag": to.Ptr("newVal"),
			},
		},
		})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

type ServiceClientBeginCreateOrUpdateOptions added in v0.2.0

type ServiceClientBeginCreateOrUpdateOptions struct {
	// Parameters for the create or update operation
	Parameters *ServiceResource
	// Resumes the LRO from the provided token.
	ResumeToken string
}

ServiceClientBeginCreateOrUpdateOptions contains the optional parameters for the ServiceClient.BeginCreateOrUpdate method.

type ServiceClientBeginDeleteOptions added in v0.2.0

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

ServiceClientBeginDeleteOptions contains the optional parameters for the ServiceClient.BeginDelete method.

type ServiceClientCheckNameAvailabilityOptions added in v0.2.0

type ServiceClientCheckNameAvailabilityOptions struct {
	// Parameters supplied to the operation.
	NameAvailabilityParameters *NameAvailabilityParameters
}

ServiceClientCheckNameAvailabilityOptions contains the optional parameters for the ServiceClient.CheckNameAvailability method.

type ServiceClientCheckNameAvailabilityResponse added in v0.2.0

type ServiceClientCheckNameAvailabilityResponse struct {
	NameAvailability
}

ServiceClientCheckNameAvailabilityResponse contains the response from method ServiceClient.CheckNameAvailability.

type ServiceClientCreateOrUpdateResponse added in v0.2.0

type ServiceClientCreateOrUpdateResponse struct {
	ServiceResource
}

ServiceClientCreateOrUpdateResponse contains the response from method ServiceClient.CreateOrUpdate.

type ServiceClientDeleteResponse added in v0.2.0

type ServiceClientDeleteResponse struct {
}

ServiceClientDeleteResponse contains the response from method ServiceClient.Delete.

type ServiceClientGetOptions added in v0.2.0

type ServiceClientGetOptions struct {
}

ServiceClientGetOptions contains the optional parameters for the ServiceClient.Get method.

type ServiceClientGetResponse added in v0.2.0

type ServiceClientGetResponse struct {
	ServiceResource
}

ServiceClientGetResponse contains the response from method ServiceClient.Get.

type ServiceClientLinkNotificationHubOptions added in v0.2.0

type ServiceClientLinkNotificationHubOptions struct {
	// Parameters supplied to the operation.
	LinkNotificationHubParameters *LinkNotificationHubParameters
}

ServiceClientLinkNotificationHubOptions contains the optional parameters for the ServiceClient.LinkNotificationHub method.

type ServiceClientLinkNotificationHubResponse added in v0.2.0

type ServiceClientLinkNotificationHubResponse struct {
	LinkedNotificationHub
}

ServiceClientLinkNotificationHubResponse contains the response from method ServiceClient.LinkNotificationHub.

type ServiceClientListByResourceGroupOptions added in v0.2.0

type ServiceClientListByResourceGroupOptions struct {
}

ServiceClientListByResourceGroupOptions contains the optional parameters for the ServiceClient.ListByResourceGroup method.

type ServiceClientListByResourceGroupResponse added in v0.2.0

type ServiceClientListByResourceGroupResponse struct {
	ServiceResourceList
}

ServiceClientListByResourceGroupResponse contains the response from method ServiceClient.ListByResourceGroup.

type ServiceClientListBySubscriptionOptions added in v0.2.0

type ServiceClientListBySubscriptionOptions struct {
}

ServiceClientListBySubscriptionOptions contains the optional parameters for the ServiceClient.ListBySubscription method.

type ServiceClientListBySubscriptionResponse added in v0.2.0

type ServiceClientListBySubscriptionResponse struct {
	ServiceResourceList
}

ServiceClientListBySubscriptionResponse contains the response from method ServiceClient.ListBySubscription.

type ServiceClientListKeysOptions added in v0.2.0

type ServiceClientListKeysOptions struct {
}

ServiceClientListKeysOptions contains the optional parameters for the ServiceClient.ListKeys method.

type ServiceClientListKeysResponse added in v0.2.0

type ServiceClientListKeysResponse struct {
	ServiceKeys
}

ServiceClientListKeysResponse contains the response from method ServiceClient.ListKeys.

type ServiceClientRegenerateKeyOptions added in v0.2.0

type ServiceClientRegenerateKeyOptions struct {
}

ServiceClientRegenerateKeyOptions contains the optional parameters for the ServiceClient.RegenerateKey method.

type ServiceClientRegenerateKeyResponse added in v0.2.0

type ServiceClientRegenerateKeyResponse struct {
	ServiceKeys
}

ServiceClientRegenerateKeyResponse contains the response from method ServiceClient.RegenerateKey.

type ServiceClientUpdateOptions added in v0.2.0

type ServiceClientUpdateOptions struct {
	// Parameters for the update operation
	Parameters *ServiceResource
}

ServiceClientUpdateOptions contains the optional parameters for the ServiceClient.Update method.

type ServiceClientUpdateResponse added in v0.2.0

type ServiceClientUpdateResponse struct {
	ServiceResource
}

ServiceClientUpdateResponse contains the response from method ServiceClient.Update.

type ServiceKeys added in v0.2.0

type ServiceKeys struct {
	// CommunicationService connection string constructed via the primaryKey
	PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"`

	// The primary access key.
	PrimaryKey *string `json:"primaryKey,omitempty"`

	// CommunicationService connection string constructed via the secondaryKey
	SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"`

	// The secondary access key.
	SecondaryKey *string `json:"secondaryKey,omitempty"`
}

ServiceKeys - A class representing the access keys of a CommunicationService.

type ServiceProperties added in v0.2.0

type ServiceProperties struct {
	// REQUIRED; The location where the communication service stores its data at rest.
	DataLocation *string `json:"dataLocation,omitempty"`

	// READ-ONLY; FQDN of the CommunicationService instance.
	HostName *string `json:"hostName,omitempty" azure:"ro"`

	// READ-ONLY; The immutable resource Id of the communication service.
	ImmutableResourceID *string `json:"immutableResourceId,omitempty" azure:"ro"`

	// READ-ONLY; Resource ID of an Azure Notification Hub linked to this resource.
	NotificationHubID *string `json:"notificationHubId,omitempty" azure:"ro"`

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

	// READ-ONLY; Version of the CommunicationService resource. Probably you need the same or higher version of client SDKs.
	Version *string `json:"version,omitempty" azure:"ro"`
}

ServiceProperties - A class that describes the properties of the CommunicationService.

type ServiceResource added in v0.2.0

type ServiceResource struct {
	// The Azure location where the CommunicationService is running.
	Location *string `json:"location,omitempty"`

	// The properties of the service.
	Properties *ServiceProperties `json:"properties,omitempty"`

	// Tags of the service which is a list of key value pairs that describe the resource.
	Tags map[string]*string `json:"tags,omitempty"`

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string `json:"id,omitempty" azure:"ro"`

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

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

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string `json:"type,omitempty" azure:"ro"`
}

ServiceResource - A class representing a CommunicationService resource.

func (ServiceResource) MarshalJSON added in v0.2.0

func (s ServiceResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ServiceResource.

type ServiceResourceList added in v0.2.0

type ServiceResourceList struct {
	// The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use.
	NextLink *string `json:"nextLink,omitempty"`

	// List of CommunicationService
	Value []*ServiceResource `json:"value,omitempty"`
}

ServiceResourceList - Object that includes an array of CommunicationServices and a possible link for next set.

type SystemData

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

	// The identity that created the resource.
	CreatedBy *string `json:"createdBy,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 identity that last modified the resource.
	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`

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

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

func (SystemData) MarshalJSON

func (s SystemData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SystemData.

func (*SystemData) UnmarshalJSON

func (s *SystemData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.

type TaggedResource

type TaggedResource struct {
	// Tags of the service which is a list of key value pairs that describe the resource.
	Tags map[string]*string `json:"tags,omitempty"`
}

TaggedResource - An ARM resource with that can accept tags

func (TaggedResource) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type TaggedResource.

Jump to

Keyboard shortcuts

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