Documentation
¶
Index ¶
- type ActionType
- type AdministratorProperties
- type AuthConfigProperties
- type AuthenticationMode
- type BackupProperties
- type CheckNameAvailabilityReason
- type CheckNameAvailabilityRequest
- type CheckNameAvailabilityResponse
- type ClientFactory
- func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient
- func (c *ClientFactory) NewMongoClustersClient() *MongoClustersClient
- func (c *ClientFactory) NewOperationsClient() *OperationsClient
- func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient
- func (c *ClientFactory) NewPrivateLinksClient() *PrivateLinksClient
- func (c *ClientFactory) NewReplicasClient() *ReplicasClient
- func (c *ClientFactory) NewUsersClient() *UsersClient
- type ComputeProperties
- type ConnectionString
- type CreateMode
- type CreatedByType
- type CustomerManagedKeyEncryptionProperties
- type DataAPIMode
- type DataAPIProperties
- type DatabaseRole
- type EncryptionProperties
- type EntraIdentityProvider
- type EntraIdentityProviderProperties
- type EntraPrincipalType
- type FirewallRule
- type FirewallRuleListResult
- type FirewallRuleProperties
- type FirewallRulesClient
- func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (*runtime.Poller[FirewallRulesClientCreateOrUpdateResponse], error)
- func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (*runtime.Poller[FirewallRulesClientDeleteResponse], error)
- func (client *FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (FirewallRulesClientGetResponse, error)
- func (client *FirewallRulesClient) NewListByMongoClusterPager(resourceGroupName string, mongoClusterName string, ...) *runtime.Pager[FirewallRulesClientListByMongoClusterResponse]
- type FirewallRulesClientBeginCreateOrUpdateOptions
- type FirewallRulesClientBeginDeleteOptions
- type FirewallRulesClientCreateOrUpdateResponse
- type FirewallRulesClientDeleteResponse
- type FirewallRulesClientGetOptions
- type FirewallRulesClientGetResponse
- type FirewallRulesClientListByMongoClusterOptions
- type FirewallRulesClientListByMongoClusterResponse
- type HighAvailabilityMode
- type HighAvailabilityProperties
- type IdentityProvider
- type IdentityProviderClassification
- type IdentityProviderType
- type KeyEncryptionKeyIdentity
- type KeyEncryptionKeyIdentityType
- type ListConnectionStringsResult
- type ListResult
- type ManagedServiceIdentity
- type ManagedServiceIdentityType
- type MongoCluster
- type MongoClustersClient
- func (client *MongoClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (*runtime.Poller[MongoClustersClientCreateOrUpdateResponse], error)
- func (client *MongoClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (*runtime.Poller[MongoClustersClientDeleteResponse], error)
- func (client *MongoClustersClient) BeginPromote(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (*runtime.Poller[MongoClustersClientPromoteResponse], error)
- func (client *MongoClustersClient) BeginUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (*runtime.Poller[MongoClustersClientUpdateResponse], error)
- func (client *MongoClustersClient) CheckNameAvailability(ctx context.Context, location string, body CheckNameAvailabilityRequest, ...) (MongoClustersClientCheckNameAvailabilityResponse, error)
- func (client *MongoClustersClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (MongoClustersClientGetResponse, error)
- func (client *MongoClustersClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (MongoClustersClientListConnectionStringsResponse, error)
- func (client *MongoClustersClient) NewListByResourceGroupPager(resourceGroupName string, ...) *runtime.Pager[MongoClustersClientListByResourceGroupResponse]
- func (client *MongoClustersClient) NewListPager(options *MongoClustersClientListOptions) *runtime.Pager[MongoClustersClientListResponse]
- type MongoClustersClientBeginCreateOrUpdateOptions
- type MongoClustersClientBeginDeleteOptions
- type MongoClustersClientBeginPromoteOptions
- type MongoClustersClientBeginUpdateOptions
- type MongoClustersClientCheckNameAvailabilityOptions
- type MongoClustersClientCheckNameAvailabilityResponse
- type MongoClustersClientCreateOrUpdateResponse
- type MongoClustersClientDeleteResponse
- type MongoClustersClientGetOptions
- type MongoClustersClientGetResponse
- type MongoClustersClientListByResourceGroupOptions
- type MongoClustersClientListByResourceGroupResponse
- type MongoClustersClientListConnectionStringsOptions
- type MongoClustersClientListConnectionStringsResponse
- type MongoClustersClientListOptions
- type MongoClustersClientListResponse
- type MongoClustersClientPromoteResponse
- type MongoClustersClientUpdateResponse
- type Operation
- type OperationDisplay
- type OperationListResult
- type OperationsClient
- type OperationsClientListOptions
- type OperationsClientListResponse
- type Origin
- type PreviewFeature
- type PrivateEndpoint
- type PrivateEndpointConnection
- type PrivateEndpointConnectionProperties
- type PrivateEndpointConnectionProvisioningState
- type PrivateEndpointConnectionResource
- type PrivateEndpointConnectionResourceListResult
- type PrivateEndpointConnectionsClient
- func (client *PrivateEndpointConnectionsClient) BeginCreate(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (*runtime.Poller[PrivateEndpointConnectionsClientCreateResponse], error)
- func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error)
- func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (PrivateEndpointConnectionsClientGetResponse, error)
- func (client *PrivateEndpointConnectionsClient) NewListByMongoClusterPager(resourceGroupName string, mongoClusterName string, ...) *runtime.Pager[PrivateEndpointConnectionsClientListByMongoClusterResponse]
- type PrivateEndpointConnectionsClientBeginCreateOptions
- type PrivateEndpointConnectionsClientBeginDeleteOptions
- type PrivateEndpointConnectionsClientCreateResponse
- type PrivateEndpointConnectionsClientDeleteResponse
- type PrivateEndpointConnectionsClientGetOptions
- type PrivateEndpointConnectionsClientGetResponse
- type PrivateEndpointConnectionsClientListByMongoClusterOptions
- type PrivateEndpointConnectionsClientListByMongoClusterResponse
- type PrivateEndpointServiceConnectionStatus
- type PrivateLinkResource
- type PrivateLinkResourceListResult
- type PrivateLinkResourceProperties
- type PrivateLinkServiceConnectionState
- type PrivateLinksClient
- type PrivateLinksClientListByMongoClusterOptions
- type PrivateLinksClientListByMongoClusterResponse
- type PromoteMode
- type PromoteOption
- type PromoteReplicaRequest
- type Properties
- type ProvisioningState
- type PublicNetworkAccess
- type Replica
- type ReplicaListResult
- type ReplicaParameters
- type ReplicasClient
- type ReplicasClientListByParentOptions
- type ReplicasClientListByParentResponse
- type ReplicationProperties
- type ReplicationRole
- type ReplicationState
- type RestoreParameters
- type ShardingProperties
- type Status
- type StorageProperties
- type StorageType
- type SystemData
- type Update
- type UpdateProperties
- type User
- type UserAssignedIdentity
- type UserListResult
- type UserProperties
- type UserRole
- type UsersClient
- func (client *UsersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (*runtime.Poller[UsersClientCreateOrUpdateResponse], error)
- func (client *UsersClient) BeginDelete(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (*runtime.Poller[UsersClientDeleteResponse], error)
- func (client *UsersClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, ...) (UsersClientGetResponse, error)
- func (client *UsersClient) NewListByMongoClusterPager(resourceGroupName string, mongoClusterName string, ...) *runtime.Pager[UsersClientListByMongoClusterResponse]
- type UsersClientBeginCreateOrUpdateOptions
- type UsersClientBeginDeleteOptions
- type UsersClientCreateOrUpdateResponse
- type UsersClientDeleteResponse
- type UsersClientGetOptions
- type UsersClientGetResponse
- type UsersClientListByMongoClusterOptions
- type UsersClientListByMongoClusterResponse
Examples ¶
- FirewallRulesClient.BeginCreateOrUpdate
- FirewallRulesClient.BeginDelete
- FirewallRulesClient.Get
- FirewallRulesClient.NewListByMongoClusterPager
- MongoClustersClient.BeginCreateOrUpdate (CreatesAMongoClusterResourceFromAPointInTimeRestore)
- MongoClustersClient.BeginCreateOrUpdate (CreatesAMongoClusterResourceFromAPointInTimeRestoreWithMicrosoftEntraIdAuthenticationModeEnabled)
- MongoClustersClient.BeginCreateOrUpdate (CreatesAMongoClusterResourceWithCustomerManagedKeyEncryptionFromAPointInTimeRestore)
- MongoClustersClient.BeginCreateOrUpdate (CreatesANewMongoClusterResource)
- MongoClustersClient.BeginCreateOrUpdate (CreatesANewMongoClusterResourceWithCustomerManagedKeyEncryption)
- MongoClustersClient.BeginCreateOrUpdate (CreatesANewMongoClusterResourceWithPremiumSsDv2Storage)
- MongoClustersClient.BeginCreateOrUpdate (CreatesAReplicaMongoClusterResourceFromASourceResource)
- MongoClustersClient.BeginCreateOrUpdate (CreatesAReplicaMongoClusterResourceWithCustomerManagedKeyEncryptionFromASourceResource)
- MongoClustersClient.BeginDelete
- MongoClustersClient.BeginPromote
- MongoClustersClient.BeginUpdate (DisablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection)
- MongoClustersClient.BeginUpdate (EnablesDataApiOnAMongoClusterResource)
- MongoClustersClient.BeginUpdate (ResetsTheAdministratorLoginPassword)
- MongoClustersClient.BeginUpdate (UpdatesAMongoClusterResource)
- MongoClustersClient.BeginUpdate (UpdatesTheAllowedAuthenticationModesToIncludeMicrosoftEntraIdAuthentication)
- MongoClustersClient.BeginUpdate (UpdatesTheAllowedAuthenticationModesToRemoveNativeAuthentication)
- MongoClustersClient.BeginUpdate (UpdatesTheCustomerManagedEncryptionKeyOnAMongoClusterResource)
- MongoClustersClient.BeginUpdate (UpdatesTheDiskSizeOnAMongoClusterResource)
- MongoClustersClient.BeginUpdate (UpdatesThePremiumSsDv2SizeOnAMongoClusterResource)
- MongoClustersClient.CheckNameAvailability (ChecksAndConfirmsTheMongoClusterNameIsAvailabilityForUse)
- MongoClustersClient.CheckNameAvailability (ChecksAndReturnsThatTheMongoClusterNameIsAlreadyInUse)
- MongoClustersClient.Get
- MongoClustersClient.ListConnectionStrings
- MongoClustersClient.NewListByResourceGroupPager
- MongoClustersClient.NewListPager
- OperationsClient.NewListPager
- PrivateEndpointConnectionsClient.BeginCreate
- PrivateEndpointConnectionsClient.BeginDelete
- PrivateEndpointConnectionsClient.Get
- PrivateEndpointConnectionsClient.NewListByMongoClusterPager
- PrivateLinksClient.NewListByMongoClusterPager
- ReplicasClient.NewListByParentPager
- UsersClient.BeginCreateOrUpdate
- UsersClient.BeginDelete
- UsersClient.Get
- UsersClient.NewListByMongoClusterPager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType string
ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
const ( // ActionTypeInternal - Actions are for internal-only APIs. ActionTypeInternal ActionType = "Internal" )
func PossibleActionTypeValues ¶
func PossibleActionTypeValues() []ActionType
PossibleActionTypeValues returns the possible values for the ActionType const type.
type AdministratorProperties ¶ added in v1.0.0
type AdministratorProperties struct {
// The administrator password.
Password *string
// The administrator user name.
UserName *string
}
AdministratorProperties - The local administrator login properties.
func (AdministratorProperties) MarshalJSON ¶ added in v1.0.0
func (a AdministratorProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AdministratorProperties.
func (*AdministratorProperties) UnmarshalJSON ¶ added in v1.0.0
func (a *AdministratorProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AdministratorProperties.
type AuthConfigProperties ¶ added in v1.1.0
type AuthConfigProperties struct {
// Allowed authentication modes for data access on the cluster.
AllowedModes []*AuthenticationMode
}
AuthConfigProperties - The authentication configuration for the Mongo cluster.
func (AuthConfigProperties) MarshalJSON ¶ added in v1.1.0
func (a AuthConfigProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AuthConfigProperties.
func (*AuthConfigProperties) UnmarshalJSON ¶ added in v1.1.0
func (a *AuthConfigProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AuthConfigProperties.
type AuthenticationMode ¶ added in v1.1.0
type AuthenticationMode string
AuthenticationMode - The authentication modes supporting on the Mongo cluster.
const ( // AuthenticationModeMicrosoftEntraID - Microsoft Entra ID authentication mode using Entra users assigned to the cluster and // auth mechanism 'MONGODB-OIDC'. AuthenticationModeMicrosoftEntraID AuthenticationMode = "MicrosoftEntraID" // AuthenticationModeNativeAuth - Native mongo authentication mode using username and password with auth mechanism 'SCRAM-SHA-256'. AuthenticationModeNativeAuth AuthenticationMode = "NativeAuth" )
func PossibleAuthenticationModeValues ¶ added in v1.1.0
func PossibleAuthenticationModeValues() []AuthenticationMode
PossibleAuthenticationModeValues returns the possible values for the AuthenticationMode const type.
type BackupProperties ¶ added in v1.0.0
type BackupProperties struct {
// READ-ONLY; Earliest restore timestamp in UTC ISO8601 format.
EarliestRestoreTime *string
}
BackupProperties - The backup properties of the cluster. This includes the earliest restore time and retention settings.
func (BackupProperties) MarshalJSON ¶ added in v1.0.0
func (b BackupProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BackupProperties.
func (*BackupProperties) UnmarshalJSON ¶ added in v1.0.0
func (b *BackupProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BackupProperties.
type CheckNameAvailabilityReason ¶
type CheckNameAvailabilityReason string
CheckNameAvailabilityReason - Possible reasons for a name not being available.
const ( // CheckNameAvailabilityReasonAlreadyExists - Name already exists. CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" // CheckNameAvailabilityReasonInvalid - Name is invalid. CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" )
func PossibleCheckNameAvailabilityReasonValues ¶
func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason
PossibleCheckNameAvailabilityReasonValues returns the possible values for the CheckNameAvailabilityReason const type.
type CheckNameAvailabilityRequest ¶
type CheckNameAvailabilityRequest struct {
// The name of the resource for which availability needs to be checked.
Name *string
// The resource type.
Type *string
}
CheckNameAvailabilityRequest - The check availability request body.
func (CheckNameAvailabilityRequest) MarshalJSON ¶
func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest.
func (*CheckNameAvailabilityRequest) UnmarshalJSON ¶
func (c *CheckNameAvailabilityRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityRequest.
type CheckNameAvailabilityResponse ¶
type CheckNameAvailabilityResponse struct {
// Detailed reason why the given name is not available.
Message *string
// Indicates if the resource name is available.
NameAvailable *bool
// The reason why the given name is not available.
Reason *CheckNameAvailabilityReason
}
CheckNameAvailabilityResponse - The check availability result.
func (CheckNameAvailabilityResponse) MarshalJSON ¶
func (c CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResponse.
func (*CheckNameAvailabilityResponse) UnmarshalJSON ¶
func (c *CheckNameAvailabilityResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResponse.
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. The value must be an UUID.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ClientFactory) NewFirewallRulesClient ¶
func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient
NewFirewallRulesClient creates a new instance of FirewallRulesClient.
func (*ClientFactory) NewMongoClustersClient ¶
func (c *ClientFactory) NewMongoClustersClient() *MongoClustersClient
NewMongoClustersClient creates a new instance of MongoClustersClient.
func (*ClientFactory) NewOperationsClient ¶
func (c *ClientFactory) NewOperationsClient() *OperationsClient
NewOperationsClient creates a new instance of OperationsClient.
func (*ClientFactory) NewPrivateEndpointConnectionsClient ¶
func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient
NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient.
func (*ClientFactory) NewPrivateLinksClient ¶
func (c *ClientFactory) NewPrivateLinksClient() *PrivateLinksClient
NewPrivateLinksClient creates a new instance of PrivateLinksClient.
func (*ClientFactory) NewReplicasClient ¶ added in v0.2.0
func (c *ClientFactory) NewReplicasClient() *ReplicasClient
NewReplicasClient creates a new instance of ReplicasClient.
func (*ClientFactory) NewUsersClient ¶ added in v1.1.0
func (c *ClientFactory) NewUsersClient() *UsersClient
NewUsersClient creates a new instance of UsersClient.
type ComputeProperties ¶ added in v1.0.0
type ComputeProperties struct {
// The compute tier to assign to the cluster, where each tier maps to a virtual-core and memory size. Example values: 'M30',
// 'M40'.
Tier *string
}
ComputeProperties - The compute properties of the cluster. This includes the virtual-cores/memory and scaling options applied to servers in the cluster.
func (ComputeProperties) MarshalJSON ¶ added in v1.0.0
func (c ComputeProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ComputeProperties.
func (*ComputeProperties) UnmarshalJSON ¶ added in v1.0.0
func (c *ComputeProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ComputeProperties.
type ConnectionString ¶
type ConnectionString struct {
// READ-ONLY; Value of the connection string
ConnectionString *string
// READ-ONLY; Description of the connection string
Description *string
// READ-ONLY; Name of the connection string.
Name *string
}
ConnectionString - Connection string for the mongo cluster
func (ConnectionString) MarshalJSON ¶
func (c ConnectionString) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ConnectionString.
func (*ConnectionString) UnmarshalJSON ¶
func (c *ConnectionString) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionString.
type CreateMode ¶
type CreateMode string
CreateMode - The mode that the Mongo Cluster is created with.
const ( // CreateModeDefault - Create a new mongo cluster. CreateModeDefault CreateMode = "Default" // CreateModeGeoReplica - Create a replica cluster in distinct geographic region from the source cluster. CreateModeGeoReplica CreateMode = "GeoReplica" // CreateModePointInTimeRestore - Create a mongo cluster from a restore point-in-time. CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" // CreateModeReplica - Create a replica cluster in the same geographic region as the source cluster. CreateModeReplica CreateMode = "Replica" )
func PossibleCreateModeValues ¶
func PossibleCreateModeValues() []CreateMode
PossibleCreateModeValues returns the possible values for the CreateMode const type.
type CreatedByType ¶
type CreatedByType string
CreatedByType - The kind of entity that created the resource.
const ( // CreatedByTypeApplication - The entity was created by an application. CreatedByTypeApplication CreatedByType = "Application" // CreatedByTypeKey - The entity was created by a key. CreatedByTypeKey CreatedByType = "Key" // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" // CreatedByTypeUser - The entity was created by a user. CreatedByTypeUser CreatedByType = "User" )
func PossibleCreatedByTypeValues ¶
func PossibleCreatedByTypeValues() []CreatedByType
PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.
type CustomerManagedKeyEncryptionProperties ¶ added in v1.1.0
type CustomerManagedKeyEncryptionProperties struct {
// The identity used to access the key encryption key.
KeyEncryptionKeyIdentity *KeyEncryptionKeyIdentity
// The URI of the key vault key used for encryption.
KeyEncryptionKeyURL *string
}
CustomerManagedKeyEncryptionProperties - Customer managed key encryption settings.
func (CustomerManagedKeyEncryptionProperties) MarshalJSON ¶ added in v1.1.0
func (c CustomerManagedKeyEncryptionProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CustomerManagedKeyEncryptionProperties.
func (*CustomerManagedKeyEncryptionProperties) UnmarshalJSON ¶ added in v1.1.0
func (c *CustomerManagedKeyEncryptionProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CustomerManagedKeyEncryptionProperties.
type DataAPIMode ¶ added in v1.1.0
type DataAPIMode string
DataAPIMode - The mode to apply to the Mongo Data API.
const ( // DataAPIModeDisabled - Mongo Data API is disabled for the cluster. DataAPIModeDisabled DataAPIMode = "Disabled" // DataAPIModeEnabled - Mongo Data API is enabled for the cluster. DataAPIModeEnabled DataAPIMode = "Enabled" )
func PossibleDataAPIModeValues ¶ added in v1.1.0
func PossibleDataAPIModeValues() []DataAPIMode
PossibleDataAPIModeValues returns the possible values for the DataAPIMode const type.
type DataAPIProperties ¶ added in v1.1.0
type DataAPIProperties struct {
// The mode to indicate whether the Mongo Data API is enabled for a cluster.
Mode *DataAPIMode
}
DataAPIProperties - Data API properties.
func (DataAPIProperties) MarshalJSON ¶ added in v1.1.0
func (d DataAPIProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type DataAPIProperties.
func (*DataAPIProperties) UnmarshalJSON ¶ added in v1.1.0
func (d *DataAPIProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type DataAPIProperties.
type DatabaseRole ¶ added in v1.1.0
type DatabaseRole struct {
// REQUIRED; Database scope that the role is assigned to.
Db *string
// REQUIRED; The role that is assigned to the user on the database scope.
Role *UserRole
}
DatabaseRole - Database role definition that is assigned to a user.
func (DatabaseRole) MarshalJSON ¶ added in v1.1.0
func (d DatabaseRole) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type DatabaseRole.
func (*DatabaseRole) UnmarshalJSON ¶ added in v1.1.0
func (d *DatabaseRole) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseRole.
type EncryptionProperties ¶ added in v1.1.0
type EncryptionProperties struct {
// Customer managed key encryption settings.
CustomerManagedKeyEncryption *CustomerManagedKeyEncryptionProperties
}
EncryptionProperties - The encryption configuration for the mongo cluster.
func (EncryptionProperties) MarshalJSON ¶ added in v1.1.0
func (e EncryptionProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type EncryptionProperties.
func (*EncryptionProperties) UnmarshalJSON ¶ added in v1.1.0
func (e *EncryptionProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionProperties.
type EntraIdentityProvider ¶ added in v1.1.0
type EntraIdentityProvider struct {
// REQUIRED; The Entra identity properties for the user.
Properties *EntraIdentityProviderProperties
// CONSTANT; The type of identity provider that the user belongs to.
// Field has constant value IdentityProviderTypeMicrosoftEntraID, any specified value is ignored.
Type *IdentityProviderType
}
EntraIdentityProvider - Defines a Microsoft Entra ID Mongo user.
func (*EntraIdentityProvider) GetIdentityProvider ¶ added in v1.1.0
func (e *EntraIdentityProvider) GetIdentityProvider() *IdentityProvider
GetIdentityProvider implements the IdentityProviderClassification interface for type EntraIdentityProvider.
func (EntraIdentityProvider) MarshalJSON ¶ added in v1.1.0
func (e EntraIdentityProvider) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type EntraIdentityProvider.
func (*EntraIdentityProvider) UnmarshalJSON ¶ added in v1.1.0
func (e *EntraIdentityProvider) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type EntraIdentityProvider.
type EntraIdentityProviderProperties ¶ added in v1.1.0
type EntraIdentityProviderProperties struct {
// REQUIRED; The principal type of the user.
PrincipalType *EntraPrincipalType
}
EntraIdentityProviderProperties - Microsoft Entra ID provider properties.
func (EntraIdentityProviderProperties) MarshalJSON ¶ added in v1.1.0
func (e EntraIdentityProviderProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type EntraIdentityProviderProperties.
func (*EntraIdentityProviderProperties) UnmarshalJSON ¶ added in v1.1.0
func (e *EntraIdentityProviderProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type EntraIdentityProviderProperties.
type EntraPrincipalType ¶ added in v1.1.0
type EntraPrincipalType string
EntraPrincipalType - Microsoft Entra ID principal types available for a Mongo user.
const ( // EntraPrincipalTypeServicePrincipal - Entra service principal type. EntraPrincipalTypeServicePrincipal EntraPrincipalType = "servicePrincipal" // EntraPrincipalTypeUser - Entra user type. EntraPrincipalTypeUser EntraPrincipalType = "user" )
func PossibleEntraPrincipalTypeValues ¶ added in v1.1.0
func PossibleEntraPrincipalTypeValues() []EntraPrincipalType
PossibleEntraPrincipalTypeValues returns the possible values for the EntraPrincipalType const type.
type FirewallRule ¶
type FirewallRule struct {
// The resource-specific properties for this resource.
Properties *FirewallRuleProperties
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
FirewallRule - Represents a mongo cluster firewall rule.
func (FirewallRule) MarshalJSON ¶
func (f FirewallRule) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type FirewallRule.
func (*FirewallRule) UnmarshalJSON ¶
func (f *FirewallRule) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRule.
type FirewallRuleListResult ¶
type FirewallRuleListResult struct {
// REQUIRED; The FirewallRule items on this page
Value []*FirewallRule
// The link to the next page of items
NextLink *string
}
FirewallRuleListResult - The response of a FirewallRule list operation.
func (FirewallRuleListResult) MarshalJSON ¶
func (f FirewallRuleListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type FirewallRuleListResult.
func (*FirewallRuleListResult) UnmarshalJSON ¶
func (f *FirewallRuleListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleListResult.
type FirewallRuleProperties ¶
type FirewallRuleProperties struct {
// REQUIRED; The end IP address of the mongo cluster firewall rule. Must be IPv4 format.
EndIPAddress *string
// REQUIRED; The start IP address of the mongo cluster firewall rule. Must be IPv4 format.
StartIPAddress *string
// READ-ONLY; The provisioning state of the firewall rule.
ProvisioningState *ProvisioningState
}
FirewallRuleProperties - The properties of a mongo cluster firewall rule.
func (FirewallRuleProperties) MarshalJSON ¶
func (f FirewallRuleProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type FirewallRuleProperties.
func (*FirewallRuleProperties) UnmarshalJSON ¶
func (f *FirewallRuleProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleProperties.
type FirewallRulesClient ¶
type FirewallRulesClient struct {
// contains filtered or unexported fields
}
FirewallRulesClient contains the methods for the FirewallRules group. Don't use this type directly, use NewFirewallRulesClient() instead.
func NewFirewallRulesClient ¶
func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallRulesClient, error)
NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values.
- subscriptionID - The ID of the target subscription. The value must be an UUID.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - Contains optional client configuration. Pass nil to accept the default values.
func (*FirewallRulesClient) BeginCreateOrUpdate ¶
func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, resource FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FirewallRulesClientCreateOrUpdateResponse], error)
BeginCreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- firewallRuleName - The name of the mongo cluster firewall rule.
- resource - Resource create parameters.
- options - FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_FirewallRuleCreate.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewFirewallRulesClient().BeginCreateOrUpdate(ctx, "TestGroup", "myMongoCluster", "rule1", armmongocluster.FirewallRule{
Properties: &armmongocluster.FirewallRuleProperties{
StartIPAddress: to.Ptr("0.0.0.0"),
EndIPAddress: to.Ptr("255.255.255.255"),
},
}, 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 = armmongocluster.FirewallRulesClientCreateOrUpdateResponse{
// FirewallRule: &armmongocluster.FirewallRule{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule1"),
// Name: to.Ptr("rule1"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.FirewallRuleProperties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// StartIPAddress: to.Ptr("0.0.0.0"),
// EndIPAddress: to.Ptr("255.255.255.255"),
// },
// },
// }
}
Output:
func (*FirewallRulesClient) BeginDelete ¶
func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*runtime.Poller[FirewallRulesClientDeleteResponse], error)
BeginDelete - Deletes a mongo cluster firewall rule. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- firewallRuleName - The name of the mongo cluster firewall rule.
- options - FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_FirewallRuleDelete.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewFirewallRulesClient().BeginDelete(ctx, "TestGroup", "myMongoCluster", "rule1", 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 (*FirewallRulesClient) Get ¶
func (client *FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (FirewallRulesClientGetResponse, error)
Get - Gets information about a mongo cluster firewall rule. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- firewallRuleName - The name of the mongo cluster firewall rule.
- options - FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_FirewallRuleGet.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewFirewallRulesClient().Get(ctx, "TestGroup", "myMongoCluster", "rule1", 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 = armmongocluster.FirewallRulesClientGetResponse{
// FirewallRule: &armmongocluster.FirewallRule{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule1"),
// Name: to.Ptr("rule1"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.FirewallRuleProperties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// StartIPAddress: to.Ptr("0.0.0.0"),
// EndIPAddress: to.Ptr("255.255.255.255"),
// },
// },
// }
}
Output:
func (*FirewallRulesClient) NewListByMongoClusterPager ¶
func (client *FirewallRulesClient) NewListByMongoClusterPager(resourceGroupName string, mongoClusterName string, options *FirewallRulesClientListByMongoClusterOptions) *runtime.Pager[FirewallRulesClientListByMongoClusterResponse]
NewListByMongoClusterPager - List all the firewall rules in a given mongo cluster.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- options - FirewallRulesClientListByMongoClusterOptions contains the optional parameters for the FirewallRulesClient.NewListByMongoClusterPager method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_FirewallRuleList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewFirewallRulesClient().NewListByMongoClusterPager("TestGroup", "myMongoCluster", 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 = armmongocluster.FirewallRulesClientListByMongoClusterResponse{
// FirewallRuleListResult: armmongocluster.FirewallRuleListResult{
// Value: []*armmongocluster.FirewallRule{
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule1"),
// Name: to.Ptr("rule1"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.FirewallRuleProperties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// StartIPAddress: to.Ptr("0.0.0.0"),
// EndIPAddress: to.Ptr("255.255.255.255"),
// },
// },
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule2"),
// Name: to.Ptr("rule2"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.FirewallRuleProperties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// StartIPAddress: to.Ptr("1.0.0.0"),
// EndIPAddress: to.Ptr("255.0.0.0"),
// },
// },
// },
// },
// }
}
}
Output:
type FirewallRulesClientBeginCreateOrUpdateOptions ¶
type FirewallRulesClientBeginCreateOrUpdateOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate method.
type FirewallRulesClientBeginDeleteOptions ¶
type FirewallRulesClientBeginDeleteOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete method.
type FirewallRulesClientCreateOrUpdateResponse ¶
type FirewallRulesClientCreateOrUpdateResponse struct {
// Represents a mongo cluster firewall rule.
FirewallRule
}
FirewallRulesClientCreateOrUpdateResponse contains the response from method FirewallRulesClient.BeginCreateOrUpdate.
type FirewallRulesClientDeleteResponse ¶
type FirewallRulesClientDeleteResponse struct {
}
FirewallRulesClientDeleteResponse contains the response from method FirewallRulesClient.BeginDelete.
type FirewallRulesClientGetOptions ¶
type FirewallRulesClientGetOptions struct {
}
FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method.
type FirewallRulesClientGetResponse ¶
type FirewallRulesClientGetResponse struct {
// Represents a mongo cluster firewall rule.
FirewallRule
}
FirewallRulesClientGetResponse contains the response from method FirewallRulesClient.Get.
type FirewallRulesClientListByMongoClusterOptions ¶
type FirewallRulesClientListByMongoClusterOptions struct {
}
FirewallRulesClientListByMongoClusterOptions contains the optional parameters for the FirewallRulesClient.NewListByMongoClusterPager method.
type FirewallRulesClientListByMongoClusterResponse ¶
type FirewallRulesClientListByMongoClusterResponse struct {
// The response of a FirewallRule list operation.
FirewallRuleListResult
}
FirewallRulesClientListByMongoClusterResponse contains the response from method FirewallRulesClient.NewListByMongoClusterPager.
type HighAvailabilityMode ¶ added in v1.0.0
type HighAvailabilityMode string
HighAvailabilityMode - The high availability modes for a cluster.
const ( // HighAvailabilityModeDisabled - High availability mode is disabled. This mode is can see availability impact during faults // or maintenance and is not recommended for production. HighAvailabilityModeDisabled HighAvailabilityMode = "Disabled" // HighAvailabilityModeSameZone - High availability mode is enabled, where each server in a shard is placed in the same availability // zone. HighAvailabilityModeSameZone HighAvailabilityMode = "SameZone" // HighAvailabilityModeZoneRedundantPreferred - High availability mode is enabled and preferences ZoneRedundant if availability // zones capacity is available in the region, otherwise falls-back to provisioning with SameZone. HighAvailabilityModeZoneRedundantPreferred HighAvailabilityMode = "ZoneRedundantPreferred" )
func PossibleHighAvailabilityModeValues ¶ added in v1.0.0
func PossibleHighAvailabilityModeValues() []HighAvailabilityMode
PossibleHighAvailabilityModeValues returns the possible values for the HighAvailabilityMode const type.
type HighAvailabilityProperties ¶ added in v1.0.0
type HighAvailabilityProperties struct {
// The target high availability mode requested for the cluster.
TargetMode *HighAvailabilityMode
}
HighAvailabilityProperties - The high availability properties of the cluster.
func (HighAvailabilityProperties) MarshalJSON ¶ added in v1.0.0
func (h HighAvailabilityProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type HighAvailabilityProperties.
func (*HighAvailabilityProperties) UnmarshalJSON ¶ added in v1.0.0
func (h *HighAvailabilityProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type HighAvailabilityProperties.
type IdentityProvider ¶ added in v1.1.0
type IdentityProvider struct {
// REQUIRED; The type of identity provider that the user belongs to.
Type *IdentityProviderType
}
IdentityProvider - Defines a user's identity provider definition.
func (*IdentityProvider) GetIdentityProvider ¶ added in v1.1.0
func (i *IdentityProvider) GetIdentityProvider() *IdentityProvider
GetIdentityProvider implements the IdentityProviderClassification interface for type IdentityProvider.
func (IdentityProvider) MarshalJSON ¶ added in v1.1.0
func (i IdentityProvider) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type IdentityProvider.
func (*IdentityProvider) UnmarshalJSON ¶ added in v1.1.0
func (i *IdentityProvider) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProvider.
type IdentityProviderClassification ¶ added in v1.1.0
type IdentityProviderClassification interface {
// GetIdentityProvider returns the IdentityProvider content of the underlying type.
GetIdentityProvider() *IdentityProvider
}
IdentityProviderClassification provides polymorphic access to related types. Call the interface's GetIdentityProvider() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *EntraIdentityProvider, *IdentityProvider
type IdentityProviderType ¶ added in v1.1.0
type IdentityProviderType string
IdentityProviderType - Identity provider types that a a user identity can belong to.
const ( // IdentityProviderTypeMicrosoftEntraID - Microsoft Entra ID provider. IdentityProviderTypeMicrosoftEntraID IdentityProviderType = "MicrosoftEntraID" )
func PossibleIdentityProviderTypeValues ¶ added in v1.1.0
func PossibleIdentityProviderTypeValues() []IdentityProviderType
PossibleIdentityProviderTypeValues returns the possible values for the IdentityProviderType const type.
type KeyEncryptionKeyIdentity ¶ added in v1.1.0
type KeyEncryptionKeyIdentity struct {
// The type of identity. Only 'UserAssignedIdentity' is supported.
IdentityType *KeyEncryptionKeyIdentityType
// The user assigned identity resource id.
UserAssignedIdentityResourceID *string
}
KeyEncryptionKeyIdentity - The identity used for key encryption key.
func (KeyEncryptionKeyIdentity) MarshalJSON ¶ added in v1.1.0
func (k KeyEncryptionKeyIdentity) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type KeyEncryptionKeyIdentity.
func (*KeyEncryptionKeyIdentity) UnmarshalJSON ¶ added in v1.1.0
func (k *KeyEncryptionKeyIdentity) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type KeyEncryptionKeyIdentity.
type KeyEncryptionKeyIdentityType ¶ added in v1.1.0
type KeyEncryptionKeyIdentityType string
KeyEncryptionKeyIdentityType - The type of identity for key encryption key.
const ( // KeyEncryptionKeyIdentityTypeUserAssignedIdentity - User assigned identity. KeyEncryptionKeyIdentityTypeUserAssignedIdentity KeyEncryptionKeyIdentityType = "UserAssignedIdentity" )
func PossibleKeyEncryptionKeyIdentityTypeValues ¶ added in v1.1.0
func PossibleKeyEncryptionKeyIdentityTypeValues() []KeyEncryptionKeyIdentityType
PossibleKeyEncryptionKeyIdentityTypeValues returns the possible values for the KeyEncryptionKeyIdentityType const type.
type ListConnectionStringsResult ¶
type ListConnectionStringsResult struct {
// READ-ONLY; An array that contains the connection strings for a mongo cluster.
ConnectionStrings []*ConnectionString
}
ListConnectionStringsResult - The connection strings for the given mongo cluster.
func (ListConnectionStringsResult) MarshalJSON ¶
func (l ListConnectionStringsResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ListConnectionStringsResult.
func (*ListConnectionStringsResult) UnmarshalJSON ¶
func (l *ListConnectionStringsResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ListConnectionStringsResult.
type ListResult ¶
type ListResult struct {
// REQUIRED; The MongoCluster items on this page
Value []*MongoCluster
// The link to the next page of items
NextLink *string
}
ListResult - The response of a MongoCluster list operation.
func (ListResult) MarshalJSON ¶
func (l ListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ListResult.
func (*ListResult) UnmarshalJSON ¶
func (l *ListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ListResult.
type ManagedServiceIdentity ¶ added in v1.1.0
type ManagedServiceIdentity struct {
// REQUIRED; The type of managed identity assigned to this resource.
Type *ManagedServiceIdentityType
// The identities assigned to this resource by the user.
UserAssignedIdentities map[string]*UserAssignedIdentity
// READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned
// identity.
PrincipalID *string
// READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.
TenantID *string
}
ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities)
func (ManagedServiceIdentity) MarshalJSON ¶ added in v1.1.0
func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity.
func (*ManagedServiceIdentity) UnmarshalJSON ¶ added in v1.1.0
func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity.
type ManagedServiceIdentityType ¶ added in v1.1.0
type ManagedServiceIdentityType string
ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
const ( // ManagedServiceIdentityTypeNone - No managed identity. ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" )
func PossibleManagedServiceIdentityTypeValues ¶ added in v1.1.0
func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType
PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type.
type MongoCluster ¶
type MongoCluster struct {
// REQUIRED; The geo-location where the resource lives
Location *string
// The managed service identities assigned to this resource.
Identity *ManagedServiceIdentity
// The resource-specific properties for this resource.
Properties *Properties
// Resource tags.
Tags map[string]*string
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
MongoCluster - Represents a mongo cluster resource.
func (MongoCluster) MarshalJSON ¶
func (m MongoCluster) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MongoCluster.
func (*MongoCluster) UnmarshalJSON ¶
func (m *MongoCluster) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MongoCluster.
type MongoClustersClient ¶
type MongoClustersClient struct {
// contains filtered or unexported fields
}
MongoClustersClient contains the methods for the MongoClusters group. Don't use this type directly, use NewMongoClustersClient() instead.
func NewMongoClustersClient ¶
func NewMongoClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MongoClustersClient, error)
NewMongoClustersClient creates a new instance of MongoClustersClient with the specified values.
- subscriptionID - The ID of the target subscription. The value must be an UUID.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - Contains optional client configuration. Pass nil to accept the default values.
func (*MongoClustersClient) BeginCreateOrUpdate ¶
func (client *MongoClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, resource MongoCluster, options *MongoClustersClientBeginCreateOrUpdateOptions) (*runtime.Poller[MongoClustersClientCreateOrUpdateResponse], error)
BeginCreateOrUpdate - Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- resource - Resource create parameters.
- options - MongoClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the MongoClustersClient.BeginCreateOrUpdate method.
Example (CreatesAMongoClusterResourceFromAPointInTimeRestore) ¶
Generated from example definition: 2025-09-01/MongoClusters_CreatePITR.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
"time"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.MongoCluster{
Location: to.Ptr("westus2"),
Properties: &armmongocluster.Properties{
CreateMode: to.Ptr(armmongocluster.CreateModePointInTimeRestore),
Administrator: &armmongocluster.AdministratorProperties{
UserName: to.Ptr("mongoAdmin"),
Password: to.Ptr("password"),
},
RestoreParameters: &armmongocluster.RestoreParameters{
PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-13T20:07:35Z"); return t }()),
SourceResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster"),
},
},
}, 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 = armmongocluster.MongoClustersClientCreateOrUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](128),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](1),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (CreatesAMongoClusterResourceFromAPointInTimeRestoreWithMicrosoftEntraIdAuthenticationModeEnabled) ¶
Generated from example definition: 2025-09-01/MongoClusters_CreatePITR_EntraAuth.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
"time"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.MongoCluster{
Location: to.Ptr("westus2"),
Properties: &armmongocluster.Properties{
CreateMode: to.Ptr(armmongocluster.CreateModePointInTimeRestore),
AuthConfig: &armmongocluster.AuthConfigProperties{
AllowedModes: []*armmongocluster.AuthenticationMode{
to.Ptr(armmongocluster.AuthenticationModeMicrosoftEntraID),
},
},
RestoreParameters: &armmongocluster.RestoreParameters{
PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-13T20:07:35Z"); return t }()),
SourceResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster"),
},
},
}, 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 = armmongocluster.MongoClustersClientCreateOrUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeMicrosoftEntraID),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](128),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](1),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (CreatesAMongoClusterResourceWithCustomerManagedKeyEncryptionFromAPointInTimeRestore) ¶
Generated from example definition: 2025-09-01/MongoClusters_CreatePITR_CMK.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
"time"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.MongoCluster{
Identity: &armmongocluster.ManagedServiceIdentity{
Type: to.Ptr(armmongocluster.ManagedServiceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armmongocluster.UserAssignedIdentity{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": {},
},
},
Location: to.Ptr("westus2"),
Properties: &armmongocluster.Properties{
CreateMode: to.Ptr(armmongocluster.CreateModePointInTimeRestore),
RestoreParameters: &armmongocluster.RestoreParameters{
PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-13T20:07:35Z"); return t }()),
SourceResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster"),
},
Encryption: &armmongocluster.EncryptionProperties{
CustomerManagedKeyEncryption: &armmongocluster.CustomerManagedKeyEncryptionProperties{
KeyEncryptionKeyIdentity: &armmongocluster.KeyEncryptionKeyIdentity{
IdentityType: to.Ptr(armmongocluster.KeyEncryptionKeyIdentityTypeUserAssignedIdentity),
UserAssignedIdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"),
},
KeyEncryptionKeyURL: to.Ptr("https://myVault.vault.azure.net/keys/myKey"),
},
},
},
}, 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 = armmongocluster.MongoClustersClientCreateOrUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("Microsoft.DocumentDB/mongoClusters"),
// Tags: map[string]*string{
// },
// Location: to.Ptr("westus2"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// ClusterStatus: to.Ptr(armmongocluster.StatusReady),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("7.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](32),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](1),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2025-06-01T20:07:35Z"),
// },
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// },
// InfrastructureVersion: to.Ptr("2.0"),
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// CreateMode: to.Ptr(armmongocluster.CreateModeDefault),
// Encryption: &armmongocluster.EncryptionProperties{
// CustomerManagedKeyEncryption: &armmongocluster.CustomerManagedKeyEncryptionProperties{
// KeyEncryptionKeyIdentity: &armmongocluster.KeyEncryptionKeyIdentity{
// IdentityType: to.Ptr(armmongocluster.KeyEncryptionKeyIdentityTypeUserAssignedIdentity),
// UserAssignedIdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"),
// },
// KeyEncryptionKeyURL: to.Ptr("https://myVault.vault.azure.net/keys/myKey"),
// },
// },
// },
// Identity: &armmongocluster.ManagedServiceIdentity{
// Type: to.Ptr(armmongocluster.ManagedServiceIdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armmongocluster.UserAssignedIdentity{
// "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": &armmongocluster.UserAssignedIdentity{
// PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ClientID: to.Ptr("11111111-1111-1111-1111-111111111111"),
// },
// },
// },
// },
// }
}
Output:
Example (CreatesANewMongoClusterResource) ¶
Generated from example definition: 2025-09-01/MongoClusters_Create.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.MongoCluster{
Location: to.Ptr("westus2"),
Properties: &armmongocluster.Properties{
Administrator: &armmongocluster.AdministratorProperties{
UserName: to.Ptr("mongoAdmin"),
Password: to.Ptr("password"),
},
AuthConfig: &armmongocluster.AuthConfigProperties{
AllowedModes: []*armmongocluster.AuthenticationMode{
to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
},
},
ServerVersion: to.Ptr("5.0"),
Storage: &armmongocluster.StorageProperties{
SizeGb: to.Ptr[int64](128),
},
Compute: &armmongocluster.ComputeProperties{
Tier: to.Ptr("M30"),
},
Sharding: &armmongocluster.ShardingProperties{
ShardCount: to.Ptr[int32](1),
},
HighAvailability: &armmongocluster.HighAvailabilityProperties{
TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeZoneRedundantPreferred),
},
},
}, 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 = armmongocluster.MongoClustersClientCreateOrUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](128),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](1),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (CreatesANewMongoClusterResourceWithCustomerManagedKeyEncryption) ¶
Generated from example definition: 2025-09-01/MongoClusters_Create_CMK.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.MongoCluster{
Identity: &armmongocluster.ManagedServiceIdentity{
Type: to.Ptr(armmongocluster.ManagedServiceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armmongocluster.UserAssignedIdentity{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": {},
},
},
Location: to.Ptr("westus2"),
Properties: &armmongocluster.Properties{
Administrator: &armmongocluster.AdministratorProperties{
UserName: to.Ptr("mongoAdmin"),
Password: to.Ptr("password"),
},
Storage: &armmongocluster.StorageProperties{
SizeGb: to.Ptr[int64](32),
},
Compute: &armmongocluster.ComputeProperties{
Tier: to.Ptr("M30"),
},
Sharding: &armmongocluster.ShardingProperties{
ShardCount: to.Ptr[int32](1),
},
HighAvailability: &armmongocluster.HighAvailabilityProperties{
TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeDisabled),
},
Encryption: &armmongocluster.EncryptionProperties{
CustomerManagedKeyEncryption: &armmongocluster.CustomerManagedKeyEncryptionProperties{
KeyEncryptionKeyIdentity: &armmongocluster.KeyEncryptionKeyIdentity{
IdentityType: to.Ptr(armmongocluster.KeyEncryptionKeyIdentityTypeUserAssignedIdentity),
UserAssignedIdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"),
},
KeyEncryptionKeyURL: to.Ptr("https://myVault.vault.azure.net/keys/myKey"),
},
},
},
}, 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 = armmongocluster.MongoClustersClientCreateOrUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("Microsoft.DocumentDB/mongoClusters"),
// Tags: map[string]*string{
// },
// Location: to.Ptr("westus2"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// ClusterStatus: to.Ptr(armmongocluster.StatusReady),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// ServerVersion: to.Ptr("7.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](32),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](1),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeDisabled),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2025-06-13T01:23:33Z"),
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PrivateEndpointConnections: []*armmongocluster.PrivateEndpointConnection{
// },
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// CreateMode: to.Ptr(armmongocluster.CreateModeDefault),
// Encryption: &armmongocluster.EncryptionProperties{
// CustomerManagedKeyEncryption: &armmongocluster.CustomerManagedKeyEncryptionProperties{
// KeyEncryptionKeyIdentity: &armmongocluster.KeyEncryptionKeyIdentity{
// IdentityType: to.Ptr(armmongocluster.KeyEncryptionKeyIdentityTypeUserAssignedIdentity),
// UserAssignedIdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"),
// },
// KeyEncryptionKeyURL: to.Ptr("https://myVault.vault.azure.net/keys/myKey"),
// },
// },
// },
// Identity: &armmongocluster.ManagedServiceIdentity{
// Type: to.Ptr(armmongocluster.ManagedServiceIdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armmongocluster.UserAssignedIdentity{
// "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": &armmongocluster.UserAssignedIdentity{
// PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ClientID: to.Ptr("11111111-1111-1111-1111-111111111111"),
// },
// },
// },
// },
// }
}
Output:
Example (CreatesANewMongoClusterResourceWithPremiumSsDv2Storage) ¶
Generated from example definition: 2025-09-01/MongoClusters_Create_SSDv2.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.MongoCluster{
Location: to.Ptr("westus2"),
Properties: &armmongocluster.Properties{
Administrator: &armmongocluster.AdministratorProperties{
UserName: to.Ptr("mongoAdmin"),
Password: to.Ptr("password"),
},
AuthConfig: &armmongocluster.AuthConfigProperties{
AllowedModes: []*armmongocluster.AuthenticationMode{
to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
},
},
ServerVersion: to.Ptr("5.0"),
Storage: &armmongocluster.StorageProperties{
SizeGb: to.Ptr[int64](32),
Type: to.Ptr(armmongocluster.StorageTypePremiumSSDv2),
},
Compute: &armmongocluster.ComputeProperties{
Tier: to.Ptr("M30"),
},
Sharding: &armmongocluster.ShardingProperties{
ShardCount: to.Ptr[int32](1),
},
HighAvailability: &armmongocluster.HighAvailabilityProperties{
TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeZoneRedundantPreferred),
},
},
}, 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 = armmongocluster.MongoClustersClientCreateOrUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](32),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSDv2),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](1),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (CreatesAReplicaMongoClusterResourceFromASourceResource) ¶
Generated from example definition: 2025-09-01/MongoClusters_CreateGeoReplica.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myReplicaMongoCluster", armmongocluster.MongoCluster{
Location: to.Ptr("centralus"),
Properties: &armmongocluster.Properties{
CreateMode: to.Ptr(armmongocluster.CreateModeGeoReplica),
ReplicaParameters: &armmongocluster.ReplicaParameters{
SourceResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/mySourceMongoCluster"),
SourceLocation: to.Ptr("eastus"),
},
},
}, 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 = armmongocluster.MongoClustersClientCreateOrUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myReplicaMongoCluster"),
// Name: to.Ptr("myReplicaMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](128),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](3),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// to.Ptr(armmongocluster.PreviewFeatureGeoReplicas),
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myReplicaMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// Role: to.Ptr(armmongocluster.ReplicationRoleGeoAsyncReplica),
// SourceResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/mySourceMongoCluster"),
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateProvisioning),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("centralus"),
// },
// }
}
Output:
Example (CreatesAReplicaMongoClusterResourceWithCustomerManagedKeyEncryptionFromASourceResource) ¶
Generated from example definition: 2025-09-01/MongoClusters_CreateGeoReplica_CMK.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myReplicaMongoCluster", armmongocluster.MongoCluster{
Identity: &armmongocluster.ManagedServiceIdentity{
Type: to.Ptr(armmongocluster.ManagedServiceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armmongocluster.UserAssignedIdentity{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": {},
},
},
Location: to.Ptr("centralus"),
Properties: &armmongocluster.Properties{
CreateMode: to.Ptr(armmongocluster.CreateModeGeoReplica),
ReplicaParameters: &armmongocluster.ReplicaParameters{
SourceResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/mySourceMongoCluster"),
SourceLocation: to.Ptr("eastus"),
},
Encryption: &armmongocluster.EncryptionProperties{
CustomerManagedKeyEncryption: &armmongocluster.CustomerManagedKeyEncryptionProperties{
KeyEncryptionKeyIdentity: &armmongocluster.KeyEncryptionKeyIdentity{
IdentityType: to.Ptr(armmongocluster.KeyEncryptionKeyIdentityTypeUserAssignedIdentity),
UserAssignedIdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"),
},
KeyEncryptionKeyURL: to.Ptr("https://myVault.vault.azure.net/keys/myKey"),
},
},
},
}, 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 = armmongocluster.MongoClustersClientCreateOrUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myReplicaMongoCluster"),
// Name: to.Ptr("myReplicaMongoCluster"),
// Type: to.Ptr("Microsoft.DocumentDB/mongoClusters"),
// Tags: map[string]*string{
// },
// Location: to.Ptr("centralus"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-08T10:00:00Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-08T12:00:00Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// ClusterStatus: to.Ptr(armmongocluster.StatusReady),
// CreateMode: to.Ptr(armmongocluster.CreateModeGeoReplica),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("7.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](128),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](1),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2025-06-08T12:30:00Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// to.Ptr(armmongocluster.PreviewFeatureGeoReplicas),
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myReplicaMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// Role: to.Ptr(armmongocluster.ReplicationRoleGeoAsyncReplica),
// SourceResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/mySourceMongoCluster"),
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateProvisioning),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// Encryption: &armmongocluster.EncryptionProperties{
// CustomerManagedKeyEncryption: &armmongocluster.CustomerManagedKeyEncryptionProperties{
// KeyEncryptionKeyIdentity: &armmongocluster.KeyEncryptionKeyIdentity{
// IdentityType: to.Ptr(armmongocluster.KeyEncryptionKeyIdentityTypeUserAssignedIdentity),
// UserAssignedIdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myReplicaMongoCluster"),
// },
// KeyEncryptionKeyURL: to.Ptr("https://myVault.vault.azure.net/keys/myKey"),
// },
// },
// },
// Identity: &armmongocluster.ManagedServiceIdentity{
// Type: to.Ptr(armmongocluster.ManagedServiceIdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armmongocluster.UserAssignedIdentity{
// "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myReplicaMongoCluster": &armmongocluster.UserAssignedIdentity{
// PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ClientID: to.Ptr("11111111-1111-1111-1111-111111111111"),
// },
// },
// },
// },
// }
}
Output:
func (*MongoClustersClient) BeginDelete ¶
func (client *MongoClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientBeginDeleteOptions) (*runtime.Poller[MongoClustersClientDeleteResponse], error)
BeginDelete - Deletes a mongo cluster. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- options - MongoClustersClientBeginDeleteOptions contains the optional parameters for the MongoClustersClient.BeginDelete method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_Delete.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginDelete(ctx, "TestResourceGroup", "myMongoCluster", 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 (*MongoClustersClient) BeginPromote ¶ added in v0.2.0
func (client *MongoClustersClient) BeginPromote(ctx context.Context, resourceGroupName string, mongoClusterName string, body PromoteReplicaRequest, options *MongoClustersClientBeginPromoteOptions) (*runtime.Poller[MongoClustersClientPromoteResponse], error)
BeginPromote - Promotes a replica mongo cluster to a primary role. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- body - The content of the action request
- options - MongoClustersClientBeginPromoteOptions contains the optional parameters for the MongoClustersClient.BeginPromote method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_ForcePromoteReplica.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginPromote(ctx, "TestGroup", "myMongoCluster", armmongocluster.PromoteReplicaRequest{
PromoteOption: to.Ptr(armmongocluster.PromoteOptionForced),
Mode: to.Ptr(armmongocluster.PromoteModeSwitchover),
}, 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 (*MongoClustersClient) BeginUpdate ¶
func (client *MongoClustersClient) BeginUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, properties Update, options *MongoClustersClientBeginUpdateOptions) (*runtime.Poller[MongoClustersClientUpdateResponse], error)
BeginUpdate - Updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- properties - The resource properties to be updated.
- options - MongoClustersClientBeginUpdateOptions contains the optional parameters for the MongoClustersClient.BeginUpdate method.
Example (DisablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection) ¶
Generated from example definition: 2025-09-01/MongoClusters_PatchPrivateNetworkAccess.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{
Properties: &armmongocluster.UpdateProperties{
PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessDisabled),
},
}, 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 = armmongocluster.MongoClustersClientUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](256),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PrivateEndpointConnections: []*armmongocluster.PrivateEndpointConnection{
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateEndpointConnections/mymongocluster-pe.ffffffff-ffff-ffff-ffff-ffffffffffff"),
// SystemData: &armmongocluster.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-06T04:00:25.0509765Z"); return t}()),
// CreatedBy: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-06T04:00:25.0509765Z"); return t}()),
// LastModifiedBy: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// },
// Properties: &armmongocluster.PrivateEndpointConnectionProperties{
// PrivateEndpoint: &armmongocluster.PrivateEndpoint{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.Network/privateEndpoints/mymongocluster-pe"),
// },
// GroupIDs: []*string{
// to.Ptr("MongoCluster"),
// },
// PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved),
// Description: to.Ptr("Auto-approved"),
// ActionsRequired: to.Ptr("None"),
// },
// },
// },
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessDisabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (EnablesDataApiOnAMongoClusterResource) ¶
Generated from example definition: 2025-09-01/MongoClusters_PatchDataApi.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{
Properties: &armmongocluster.UpdateProperties{
DataAPI: &armmongocluster.DataAPIProperties{
Mode: to.Ptr(armmongocluster.DataAPIModeEnabled),
},
},
}, 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 = armmongocluster.MongoClustersClientUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](256),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PrivateEndpointConnections: []*armmongocluster.PrivateEndpointConnection{
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateEndpointConnections/mymongocluster-pe.ffffffff-ffff-ffff-ffff-ffffffffffff"),
// SystemData: &armmongocluster.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-06T04:00:25.0509765Z"); return t}()),
// CreatedBy: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-06T04:00:25.0509765Z"); return t}()),
// LastModifiedBy: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// },
// Properties: &armmongocluster.PrivateEndpointConnectionProperties{
// PrivateEndpoint: &armmongocluster.PrivateEndpoint{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.Network/privateEndpoints/mymongocluster-pe"),
// },
// GroupIDs: []*string{
// to.Ptr("MongoCluster"),
// },
// PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved),
// Description: to.Ptr("Auto-approved"),
// ActionsRequired: to.Ptr("None"),
// },
// },
// },
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessDisabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeEnabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (ResetsTheAdministratorLoginPassword) ¶
Generated from example definition: 2025-09-01/MongoClusters_ResetPassword.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{
Properties: &armmongocluster.UpdateProperties{
Administrator: &armmongocluster.AdministratorProperties{
UserName: to.Ptr("mongoAdmin"),
Password: to.Ptr("password"),
},
},
}, 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 = armmongocluster.MongoClustersClientUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](256),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (UpdatesAMongoClusterResource) ¶
Generated from example definition: 2025-09-01/MongoClusters_Update.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{
Properties: &armmongocluster.UpdateProperties{
Administrator: &armmongocluster.AdministratorProperties{
UserName: to.Ptr("mongoAdmin"),
},
AuthConfig: &armmongocluster.AuthConfigProperties{
AllowedModes: []*armmongocluster.AuthenticationMode{
to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
},
},
ServerVersion: to.Ptr("5.0"),
Storage: &armmongocluster.StorageProperties{
SizeGb: to.Ptr[int64](256),
Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
},
Compute: &armmongocluster.ComputeProperties{
Tier: to.Ptr("M50"),
},
Sharding: &armmongocluster.ShardingProperties{
ShardCount: to.Ptr[int32](4),
},
HighAvailability: &armmongocluster.HighAvailabilityProperties{
TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
},
PreviewFeatures: []*armmongocluster.PreviewFeature{},
PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
DataAPI: &armmongocluster.DataAPIProperties{
Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
},
},
}, 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 = armmongocluster.MongoClustersClientUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](256),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M50"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (UpdatesTheAllowedAuthenticationModesToIncludeMicrosoftEntraIdAuthentication) ¶
Generated from example definition: 2025-09-01/MongoClusters_PatchEnableEntraIDAuth.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{
Properties: &armmongocluster.UpdateProperties{
AuthConfig: &armmongocluster.AuthConfigProperties{
AllowedModes: []*armmongocluster.AuthenticationMode{
to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
to.Ptr(armmongocluster.AuthenticationModeMicrosoftEntraID),
},
},
},
}, 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 = armmongocluster.MongoClustersClientUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// to.Ptr(armmongocluster.AuthenticationModeMicrosoftEntraID),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](256),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (UpdatesTheAllowedAuthenticationModesToRemoveNativeAuthentication) ¶
Generated from example definition: 2025-09-01/MongoClusters_PatchDisableNativeAuth.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{
Properties: &armmongocluster.UpdateProperties{
AuthConfig: &armmongocluster.AuthConfigProperties{
AllowedModes: []*armmongocluster.AuthenticationMode{
to.Ptr(armmongocluster.AuthenticationModeMicrosoftEntraID),
},
},
},
}, 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 = armmongocluster.MongoClustersClientUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeMicrosoftEntraID),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](256),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (UpdatesTheCustomerManagedEncryptionKeyOnAMongoClusterResource) ¶
Generated from example definition: 2025-09-01/MongoClusters_PatchCMK.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{
Identity: &armmongocluster.ManagedServiceIdentity{
Type: to.Ptr(armmongocluster.ManagedServiceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armmongocluster.UserAssignedIdentity{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity2": {},
},
},
Properties: &armmongocluster.UpdateProperties{
Encryption: &armmongocluster.EncryptionProperties{
CustomerManagedKeyEncryption: &armmongocluster.CustomerManagedKeyEncryptionProperties{
KeyEncryptionKeyIdentity: &armmongocluster.KeyEncryptionKeyIdentity{
IdentityType: to.Ptr(armmongocluster.KeyEncryptionKeyIdentityTypeUserAssignedIdentity),
UserAssignedIdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity2"),
},
KeyEncryptionKeyURL: to.Ptr("https://myVault.vault.azure.net/keys/myKey2"),
},
},
},
}, 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 = armmongocluster.MongoClustersClientUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](256),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PrivateEndpointConnections: []*armmongocluster.PrivateEndpointConnection{
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateEndpointConnections/mymongocluster-pe.ffffffff-ffff-ffff-ffff-ffffffffffff"),
// SystemData: &armmongocluster.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-06T04:00:25.0509765Z"); return t}()),
// CreatedBy: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-06T04:00:25.0509765Z"); return t}()),
// LastModifiedBy: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// },
// Properties: &armmongocluster.PrivateEndpointConnectionProperties{
// PrivateEndpoint: &armmongocluster.PrivateEndpoint{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.Network/privateEndpoints/mymongocluster-pe"),
// },
// GroupIDs: []*string{
// to.Ptr("MongoCluster"),
// },
// PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved),
// Description: to.Ptr("Auto-approved"),
// ActionsRequired: to.Ptr("None"),
// },
// },
// },
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessDisabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// CreateMode: to.Ptr(armmongocluster.CreateModeDefault),
// Encryption: &armmongocluster.EncryptionProperties{
// CustomerManagedKeyEncryption: &armmongocluster.CustomerManagedKeyEncryptionProperties{
// KeyEncryptionKeyIdentity: &armmongocluster.KeyEncryptionKeyIdentity{
// IdentityType: to.Ptr(armmongocluster.KeyEncryptionKeyIdentityTypeUserAssignedIdentity),
// UserAssignedIdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity2"),
// },
// KeyEncryptionKeyURL: to.Ptr("https://myVault.vault.azure.net/keys/myKey2"),
// },
// },
// },
// Identity: &armmongocluster.ManagedServiceIdentity{
// Type: to.Ptr(armmongocluster.ManagedServiceIdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armmongocluster.UserAssignedIdentity{
// "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity2": &armmongocluster.UserAssignedIdentity{
// PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ClientID: to.Ptr("11111111-1111-1111-1111-111111111111"),
// },
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (UpdatesTheDiskSizeOnAMongoClusterResource) ¶
Generated from example definition: 2025-09-01/MongoClusters_PatchDiskSize.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{
Properties: &armmongocluster.UpdateProperties{
Storage: &armmongocluster.StorageProperties{
SizeGb: to.Ptr[int64](256),
},
},
}, 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 = armmongocluster.MongoClustersClientUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](256),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
Example (UpdatesThePremiumSsDv2SizeOnAMongoClusterResource) ¶
Generated from example definition: 2025-09-01/MongoClusters_PatchSSDv2.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{
Properties: &armmongocluster.UpdateProperties{
Storage: &armmongocluster.StorageProperties{
SizeGb: to.Ptr[int64](128),
Type: to.Ptr(armmongocluster.StorageTypePremiumSSDv2),
},
},
}, 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 = armmongocluster.MongoClustersClientUpdateResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](128),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSDv2),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
func (*MongoClustersClient) CheckNameAvailability ¶
func (client *MongoClustersClient) CheckNameAvailability(ctx context.Context, location string, body CheckNameAvailabilityRequest, options *MongoClustersClientCheckNameAvailabilityOptions) (MongoClustersClientCheckNameAvailabilityResponse, error)
CheckNameAvailability - Check if mongo cluster name is available for use. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- location - The name of the Azure region.
- body - The CheckAvailability request
- options - MongoClustersClientCheckNameAvailabilityOptions contains the optional parameters for the MongoClustersClient.CheckNameAvailability method.
Example (ChecksAndConfirmsTheMongoClusterNameIsAvailabilityForUse) ¶
Generated from example definition: 2025-09-01/MongoClusters_NameAvailability.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewMongoClustersClient().CheckNameAvailability(ctx, "westus2", armmongocluster.CheckNameAvailabilityRequest{
Name: to.Ptr("newmongocluster"),
Type: to.Ptr("Microsoft.DocumentDB/mongoClusters"),
}, 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 = armmongocluster.MongoClustersClientCheckNameAvailabilityResponse{
// CheckNameAvailabilityResponse: &armmongocluster.CheckNameAvailabilityResponse{
// NameAvailable: to.Ptr(true),
// },
// }
}
Output:
Example (ChecksAndReturnsThatTheMongoClusterNameIsAlreadyInUse) ¶
Generated from example definition: 2025-09-01/MongoClusters_NameAvailability_AlreadyExists.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewMongoClustersClient().CheckNameAvailability(ctx, "westus2", armmongocluster.CheckNameAvailabilityRequest{
Name: to.Ptr("existingmongocluster"),
Type: to.Ptr("Microsoft.DocumentDB/mongoClusters"),
}, 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 = armmongocluster.MongoClustersClientCheckNameAvailabilityResponse{
// CheckNameAvailabilityResponse: &armmongocluster.CheckNameAvailabilityResponse{
// NameAvailable: to.Ptr(false),
// Reason: to.Ptr(armmongocluster.CheckNameAvailabilityReasonAlreadyExists),
// Message: to.Ptr("Cluster name 'existingmongocluster' is already in use."),
// },
// }
}
Output:
func (*MongoClustersClient) Get ¶
func (client *MongoClustersClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientGetOptions) (MongoClustersClientGetResponse, error)
Get - Gets information about a mongo cluster. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- options - MongoClustersClientGetOptions contains the optional parameters for the MongoClustersClient.Get method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_Get.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewMongoClustersClient().Get(ctx, "TestResourceGroup", "myMongoCluster", 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 = armmongocluster.MongoClustersClientGetResponse{
// MongoCluster: &armmongocluster.MongoCluster{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// Tags: map[string]*string{
// "additionalProp1": to.Ptr("string"),
// "additionalProp2": to.Ptr("string"),
// "additionalProp3": to.Ptr("string"),
// },
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](128),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// }
}
Output:
func (*MongoClustersClient) ListConnectionStrings ¶
func (client *MongoClustersClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientListConnectionStringsOptions) (MongoClustersClientListConnectionStringsResponse, error)
ListConnectionStrings - List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- options - MongoClustersClientListConnectionStringsOptions contains the optional parameters for the MongoClustersClient.ListConnectionStrings method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_ListConnectionStrings.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewMongoClustersClient().ListConnectionStrings(ctx, "TestGroup", "myMongoCluster", 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 = armmongocluster.MongoClustersClientListConnectionStringsResponse{
// ListConnectionStringsResult: &armmongocluster.ListConnectionStringsResult{
// ConnectionStrings: []*armmongocluster.ConnectionString{
// {
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Description: to.Ptr("default connection string"),
// },
// },
// },
// }
}
Output:
func (*MongoClustersClient) NewListByResourceGroupPager ¶
func (client *MongoClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *MongoClustersClientListByResourceGroupOptions) *runtime.Pager[MongoClustersClientListByResourceGroupResponse]
NewListByResourceGroupPager - List all the mongo clusters in a given resource group.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- options - MongoClustersClientListByResourceGroupOptions contains the optional parameters for the MongoClustersClient.NewListByResourceGroupPager method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_ListByResourceGroup.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMongoClustersClient().NewListByResourceGroupPager("TestResourceGroup", 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 = armmongocluster.MongoClustersClientListByResourceGroupResponse{
// ListResult: armmongocluster.ListResult{
// Value: []*armmongocluster.MongoCluster{
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// Tags: map[string]*string{
// "additionalProp1": to.Ptr("string"),
// "additionalProp2": to.Ptr("string"),
// "additionalProp3": to.Ptr("string"),
// },
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](128),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster2"),
// Name: to.Ptr("myMongoCluster2"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// Tags: map[string]*string{
// "additionalProp1": to.Ptr("string"),
// },
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user2"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](256),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M40"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](2),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("1.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster2.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("eastus"),
// },
// },
// },
// }
}
}
Output:
func (*MongoClustersClient) NewListPager ¶
func (client *MongoClustersClient) NewListPager(options *MongoClustersClientListOptions) *runtime.Pager[MongoClustersClientListResponse]
NewListPager - List all the mongo clusters in a given subscription.
Generated from API version 2025-09-01
- options - MongoClustersClientListOptions contains the optional parameters for the MongoClustersClient.NewListPager method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_List.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMongoClustersClient().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 = armmongocluster.MongoClustersClientListResponse{
// ListResult: armmongocluster.ListResult{
// Value: []*armmongocluster.MongoCluster{
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"),
// Name: to.Ptr("myMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// Tags: map[string]*string{
// "additionalProp1": to.Ptr("string"),
// "additionalProp2": to.Ptr("string"),
// "additionalProp3": to.Ptr("string"),
// },
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](128),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M30"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](4),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("2.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("westus2"),
// },
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster2"),
// Name: to.Ptr("myMongoCluster2"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// Tags: map[string]*string{
// "additionalProp1": to.Ptr("string"),
// },
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user2"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.Properties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Administrator: &armmongocluster.AdministratorProperties{
// UserName: to.Ptr("mongoAdmin"),
// },
// AuthConfig: &armmongocluster.AuthConfigProperties{
// AllowedModes: []*armmongocluster.AuthenticationMode{
// to.Ptr(armmongocluster.AuthenticationModeNativeAuth),
// },
// },
// ServerVersion: to.Ptr("5.0"),
// Storage: &armmongocluster.StorageProperties{
// SizeGb: to.Ptr[int64](256),
// Type: to.Ptr(armmongocluster.StorageTypePremiumSSD),
// },
// Compute: &armmongocluster.ComputeProperties{
// Tier: to.Ptr("M40"),
// },
// Sharding: &armmongocluster.ShardingProperties{
// ShardCount: to.Ptr[int32](2),
// },
// HighAvailability: &armmongocluster.HighAvailabilityProperties{
// TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone),
// },
// Backup: &armmongocluster.BackupProperties{
// EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"),
// },
// PreviewFeatures: []*armmongocluster.PreviewFeature{
// },
// InfrastructureVersion: to.Ptr("1.0"),
// PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled),
// ConnectionString: to.Ptr("mongodb+srv://<user>:<password>@myMongoCluster.mongocluster.cosmos.azure.com"),
// Replica: &armmongocluster.ReplicationProperties{
// ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive),
// Role: to.Ptr(armmongocluster.ReplicationRolePrimary),
// },
// DataAPI: &armmongocluster.DataAPIProperties{
// Mode: to.Ptr(armmongocluster.DataAPIModeDisabled),
// },
// },
// Location: to.Ptr("eastus"),
// },
// },
// },
// }
}
}
Output:
type MongoClustersClientBeginCreateOrUpdateOptions ¶
type MongoClustersClientBeginCreateOrUpdateOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
MongoClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the MongoClustersClient.BeginCreateOrUpdate method.
type MongoClustersClientBeginDeleteOptions ¶
type MongoClustersClientBeginDeleteOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
MongoClustersClientBeginDeleteOptions contains the optional parameters for the MongoClustersClient.BeginDelete method.
type MongoClustersClientBeginPromoteOptions ¶ added in v0.2.0
type MongoClustersClientBeginPromoteOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
MongoClustersClientBeginPromoteOptions contains the optional parameters for the MongoClustersClient.BeginPromote method.
type MongoClustersClientBeginUpdateOptions ¶
type MongoClustersClientBeginUpdateOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
MongoClustersClientBeginUpdateOptions contains the optional parameters for the MongoClustersClient.BeginUpdate method.
type MongoClustersClientCheckNameAvailabilityOptions ¶
type MongoClustersClientCheckNameAvailabilityOptions struct {
}
MongoClustersClientCheckNameAvailabilityOptions contains the optional parameters for the MongoClustersClient.CheckNameAvailability method.
type MongoClustersClientCheckNameAvailabilityResponse ¶
type MongoClustersClientCheckNameAvailabilityResponse struct {
// The check availability result.
CheckNameAvailabilityResponse
}
MongoClustersClientCheckNameAvailabilityResponse contains the response from method MongoClustersClient.CheckNameAvailability.
type MongoClustersClientCreateOrUpdateResponse ¶
type MongoClustersClientCreateOrUpdateResponse struct {
// Represents a mongo cluster resource.
MongoCluster
}
MongoClustersClientCreateOrUpdateResponse contains the response from method MongoClustersClient.BeginCreateOrUpdate.
type MongoClustersClientDeleteResponse ¶
type MongoClustersClientDeleteResponse struct {
}
MongoClustersClientDeleteResponse contains the response from method MongoClustersClient.BeginDelete.
type MongoClustersClientGetOptions ¶
type MongoClustersClientGetOptions struct {
}
MongoClustersClientGetOptions contains the optional parameters for the MongoClustersClient.Get method.
type MongoClustersClientGetResponse ¶
type MongoClustersClientGetResponse struct {
// Represents a mongo cluster resource.
MongoCluster
}
MongoClustersClientGetResponse contains the response from method MongoClustersClient.Get.
type MongoClustersClientListByResourceGroupOptions ¶
type MongoClustersClientListByResourceGroupOptions struct {
}
MongoClustersClientListByResourceGroupOptions contains the optional parameters for the MongoClustersClient.NewListByResourceGroupPager method.
type MongoClustersClientListByResourceGroupResponse ¶
type MongoClustersClientListByResourceGroupResponse struct {
// The response of a MongoCluster list operation.
ListResult
}
MongoClustersClientListByResourceGroupResponse contains the response from method MongoClustersClient.NewListByResourceGroupPager.
type MongoClustersClientListConnectionStringsOptions ¶
type MongoClustersClientListConnectionStringsOptions struct {
}
MongoClustersClientListConnectionStringsOptions contains the optional parameters for the MongoClustersClient.ListConnectionStrings method.
type MongoClustersClientListConnectionStringsResponse ¶
type MongoClustersClientListConnectionStringsResponse struct {
// The connection strings for the given mongo cluster.
ListConnectionStringsResult
}
MongoClustersClientListConnectionStringsResponse contains the response from method MongoClustersClient.ListConnectionStrings.
type MongoClustersClientListOptions ¶
type MongoClustersClientListOptions struct {
}
MongoClustersClientListOptions contains the optional parameters for the MongoClustersClient.NewListPager method.
type MongoClustersClientListResponse ¶
type MongoClustersClientListResponse struct {
// The response of a MongoCluster list operation.
ListResult
}
MongoClustersClientListResponse contains the response from method MongoClustersClient.NewListPager.
type MongoClustersClientPromoteResponse ¶ added in v0.2.0
type MongoClustersClientPromoteResponse struct {
}
MongoClustersClientPromoteResponse contains the response from method MongoClustersClient.BeginPromote.
type MongoClustersClientUpdateResponse ¶
type MongoClustersClientUpdateResponse struct {
// Represents a mongo cluster resource.
MongoCluster
}
MongoClustersClientUpdateResponse contains the response from method MongoClustersClient.BeginUpdate.
type Operation ¶
type Operation struct {
// Localized display information for this particular operation.
Display *OperationDisplay
// READ-ONLY; Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
ActionType *ActionType
// READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure
// Resource Manager/control-plane operations.
IsDataAction *bool
// 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
// 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
}
Operation - REST API Operation
Details of a REST API operation, returned from the Resource Provider Operations API
func (Operation) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Operation.
func (*Operation) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Operation.
type OperationDisplay ¶
type OperationDisplay struct {
// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views.
Description *string
// 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
// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft
// Compute".
Provider *string
// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job
// Schedule Collections".
Resource *string
}
OperationDisplay - Localized display information for and 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 {
// REQUIRED; The Operation items on this page
Value []*Operation
// The link to the next page of items
NextLink *string
}
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 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 - Contains optional client configuration. Pass nil to accept the default values.
func (*OperationsClient) NewListPager ¶
func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]
NewListPager - List the operations for the provider
Generated from API version 2025-09-01
- options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
Example ¶
Generated from example definition: 2025-09-01/Operations_List.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewOperationsClient().NewListPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page = armmongocluster.OperationsClientListResponse{
// OperationListResult: armmongocluster.OperationListResult{
// Value: []*armmongocluster.Operation{
// {
// Name: to.Ptr("Microsoft.DocumentDB/mongoClusters/read"),
// Display: &armmongocluster.OperationDisplay{
// Provider: to.Ptr("Microsoft.DocumentDB"),
// Resource: to.Ptr("Mongo Cluster"),
// Operation: to.Ptr("Read Mongo Clusters"),
// Description: to.Ptr("Reads a Mongo Cluster or list all Mongo Clusters."),
// },
// },
// {
// Name: to.Ptr("Microsoft.DocumentDB/mongoClusters/write"),
// Display: &armmongocluster.OperationDisplay{
// Provider: to.Ptr("Microsoft.DocumentDB"),
// Resource: to.Ptr("Mongo Cluster"),
// Operation: to.Ptr("Create or Update Mongo Cluster"),
// Description: to.Ptr("Create or Update the properties or tags of the specified Mongo Cluster."),
// },
// },
// },
// },
// }
}
}
Output:
type OperationsClientListOptions ¶
type OperationsClientListOptions struct {
}
OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
type OperationsClientListResponse ¶
type OperationsClientListResponse struct {
// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.
OperationListResult
}
OperationsClientListResponse contains the response from method OperationsClient.NewListPager.
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 - Indicates the operation is initiated by a system. OriginSystem Origin = "system" // OriginUser - Indicates the operation is initiated by a user. OriginUser Origin = "user" // OriginUserSystem - Indicates the operation is initiated by a user or system. OriginUserSystem Origin = "user,system" )
func PossibleOriginValues ¶
func PossibleOriginValues() []Origin
PossibleOriginValues returns the possible values for the Origin const type.
type PreviewFeature ¶ added in v0.2.0
type PreviewFeature string
PreviewFeature - Preview features that can be enabled on a mongo cluster.
const ( // PreviewFeatureGeoReplicas - Enables geo replicas preview feature. The feature must be set at create-time on new cluster // to enable linking a geo-replica cluster to it. PreviewFeatureGeoReplicas PreviewFeature = "GeoReplicas" )
func PossiblePreviewFeatureValues ¶ added in v0.2.0
func PossiblePreviewFeatureValues() []PreviewFeature
PossiblePreviewFeatureValues returns the possible values for the PreviewFeature const type.
type PrivateEndpoint ¶
type PrivateEndpoint struct {
// READ-ONLY; The resource identifier of the private endpoint
ID *string
}
PrivateEndpoint - The private endpoint resource.
func (PrivateEndpoint) MarshalJSON ¶
func (p PrivateEndpoint) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint.
func (*PrivateEndpoint) UnmarshalJSON ¶
func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint.
type PrivateEndpointConnection ¶
type PrivateEndpointConnection struct {
// The private endpoint connection properties
Properties *PrivateEndpointConnectionProperties
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
PrivateEndpointConnection - The private endpoint connection resource
func (PrivateEndpointConnection) MarshalJSON ¶
func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection.
func (*PrivateEndpointConnection) UnmarshalJSON ¶
func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection.
type PrivateEndpointConnectionProperties ¶
type PrivateEndpointConnectionProperties struct {
// REQUIRED; A collection of information about the state of the connection between service consumer and provider.
PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState
// The private endpoint resource.
PrivateEndpoint *PrivateEndpoint
// READ-ONLY; The group ids for the private endpoint resource.
GroupIDs []*string
// READ-ONLY; The provisioning state of the private endpoint connection resource.
ProvisioningState *PrivateEndpointConnectionProvisioningState
}
PrivateEndpointConnectionProperties - Properties of the private endpoint connection.
func (PrivateEndpointConnectionProperties) MarshalJSON ¶
func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties.
func (*PrivateEndpointConnectionProperties) UnmarshalJSON ¶
func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties.
type PrivateEndpointConnectionProvisioningState ¶
type PrivateEndpointConnectionProvisioningState string
PrivateEndpointConnectionProvisioningState - The current provisioning state.
const ( // PrivateEndpointConnectionProvisioningStateCreating - Connection is being created PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" // PrivateEndpointConnectionProvisioningStateDeleting - Connection is being deleted PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" // PrivateEndpointConnectionProvisioningStateFailed - Connection provisioning has failed PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" // PrivateEndpointConnectionProvisioningStateSucceeded - Connection has been provisioned PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" )
func PossiblePrivateEndpointConnectionProvisioningStateValues ¶
func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState
PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type.
type PrivateEndpointConnectionResource ¶
type PrivateEndpointConnectionResource struct {
// The resource-specific properties for this resource.
Properties *PrivateEndpointConnectionProperties
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
PrivateEndpointConnectionResource - Concrete proxy resource types can be created by aliasing this type using a specific property type.
func (PrivateEndpointConnectionResource) MarshalJSON ¶
func (p PrivateEndpointConnectionResource) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionResource.
func (*PrivateEndpointConnectionResource) UnmarshalJSON ¶
func (p *PrivateEndpointConnectionResource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionResource.
type PrivateEndpointConnectionResourceListResult ¶
type PrivateEndpointConnectionResourceListResult struct {
// REQUIRED; The PrivateEndpointConnectionResource items on this page
Value []*PrivateEndpointConnectionResource
// The link to the next page of items
NextLink *string
}
PrivateEndpointConnectionResourceListResult - The response of a PrivateEndpointConnectionResource list operation.
func (PrivateEndpointConnectionResourceListResult) MarshalJSON ¶
func (p PrivateEndpointConnectionResourceListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionResourceListResult.
func (*PrivateEndpointConnectionResourceListResult) UnmarshalJSON ¶
func (p *PrivateEndpointConnectionResourceListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionResourceListResult.
type PrivateEndpointConnectionsClient ¶
type PrivateEndpointConnectionsClient struct {
// contains filtered or unexported fields
}
PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead.
func NewPrivateEndpointConnectionsClient ¶
func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error)
NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values.
- subscriptionID - The ID of the target subscription. The value must be an UUID.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - Contains optional client configuration. Pass nil to accept the default values.
func (*PrivateEndpointConnectionsClient) BeginCreate ¶
func (client *PrivateEndpointConnectionsClient) BeginCreate(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateResponse], error)
BeginCreate - Create a Private endpoint connection If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource.
- resource - Resource create parameters.
- options - PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_PrivateEndpointConnectionPut.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreate(ctx, "TestGroup", "myMongoCluster", "pecTest", armmongocluster.PrivateEndpointConnectionResource{
Properties: &armmongocluster.PrivateEndpointConnectionProperties{
PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{
Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved),
Description: to.Ptr("Auto-Approved"),
},
},
}, 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 = armmongocluster.PrivateEndpointConnectionsClientCreateResponse{
// PrivateEndpointConnectionResource: &armmongocluster.PrivateEndpointConnectionResource{
// Name: to.Ptr("pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateEndpointConnections/pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"),
// Type: to.Ptr("Microsoft.DocumentDB/mongoClusters/privateEndpointConnections"),
// SystemData: &armmongocluster.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()),
// CreatedBy: to.Ptr("2df9eb86-36b5-49dc-86ae-9a63135bfa8c"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()),
// LastModifiedBy: to.Ptr("2ff9eb86-36b5-49dc-86ae-9a63135bfa8c"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// },
// Properties: &armmongocluster.PrivateEndpointConnectionProperties{
// ProvisioningState: to.Ptr(armmongocluster.PrivateEndpointConnectionProvisioningStateSucceeded),
// PrivateEndpoint: &armmongocluster.PrivateEndpoint{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/privateEndpoints/pecTest"),
// },
// GroupIDs: []*string{
// to.Ptr("MongoCluster"),
// },
// PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved),
// Description: to.Ptr("Approved by admin"),
// ActionsRequired: to.Ptr("None"),
// },
// },
// },
// }
}
Output:
func (*PrivateEndpointConnectionsClient) BeginDelete ¶
func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error)
BeginDelete - Delete the private endpoint connection If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource.
- options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_PrivateEndpointConnectionDelete.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "TestGroup", "myMongoCluster", "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", 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 (*PrivateEndpointConnectionsClient) Get ¶
func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error)
Get - Get a specific private connection If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource.
- options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_PrivateEndpointConnectionGet.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "TestGroup", "myMongoCluster", "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", 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 = armmongocluster.PrivateEndpointConnectionsClientGetResponse{
// PrivateEndpointConnectionResource: &armmongocluster.PrivateEndpointConnectionResource{
// Name: to.Ptr("pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateEndpointConnections/pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"),
// Type: to.Ptr("Microsoft.DocumentDB/mongoClusters/privateEndpointConnections"),
// SystemData: &armmongocluster.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()),
// CreatedBy: to.Ptr("2df9eb86-36b5-49dc-86ae-9a63135bfa8c"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()),
// LastModifiedBy: to.Ptr("2ff9eb86-36b5-49dc-86ae-9a63135bfa8c"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// },
// Properties: &armmongocluster.PrivateEndpointConnectionProperties{
// ProvisioningState: to.Ptr(armmongocluster.PrivateEndpointConnectionProvisioningStateSucceeded),
// PrivateEndpoint: &armmongocluster.PrivateEndpoint{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/privateEndpoints/pecTest"),
// },
// GroupIDs: []*string{
// to.Ptr("MongoCluster"),
// },
// PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved),
// Description: to.Ptr("Auto-approved"),
// ActionsRequired: to.Ptr("None"),
// },
// },
// },
// }
}
Output:
func (*PrivateEndpointConnectionsClient) NewListByMongoClusterPager ¶
func (client *PrivateEndpointConnectionsClient) NewListByMongoClusterPager(resourceGroupName string, mongoClusterName string, options *PrivateEndpointConnectionsClientListByMongoClusterOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByMongoClusterResponse]
NewListByMongoClusterPager - List existing private connections
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- options - PrivateEndpointConnectionsClientListByMongoClusterOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByMongoClusterPager method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_PrivateEndpointConnectionList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByMongoClusterPager("TestGroup", "myMongoCluster", 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 = armmongocluster.PrivateEndpointConnectionsClientListByMongoClusterResponse{
// PrivateEndpointConnectionResourceListResult: armmongocluster.PrivateEndpointConnectionResourceListResult{
// Value: []*armmongocluster.PrivateEndpointConnectionResource{
// {
// Name: to.Ptr("pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateEndpointConnections/pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"),
// Type: to.Ptr("Microsoft.DocumentDB/mongoClusters/privateEndpointConnections"),
// SystemData: &armmongocluster.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()),
// CreatedBy: to.Ptr("2df9eb86-36b5-49dc-86ae-9a63135bfa8c"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()),
// LastModifiedBy: to.Ptr("2ff9eb86-36b5-49dc-86ae-9a63135bfa8c"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeApplication),
// },
// Properties: &armmongocluster.PrivateEndpointConnectionProperties{
// ProvisioningState: to.Ptr(armmongocluster.PrivateEndpointConnectionProvisioningStateSucceeded),
// PrivateEndpoint: &armmongocluster.PrivateEndpoint{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/privateEndpoints/pecTest"),
// },
// GroupIDs: []*string{
// to.Ptr("MongoCluster"),
// },
// PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved),
// Description: to.Ptr("Auto-approved"),
// ActionsRequired: to.Ptr("None"),
// },
// },
// },
// },
// },
// }
}
}
Output:
type PrivateEndpointConnectionsClientBeginCreateOptions ¶
type PrivateEndpointConnectionsClientBeginCreateOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate method.
type PrivateEndpointConnectionsClientBeginDeleteOptions ¶
type PrivateEndpointConnectionsClientBeginDeleteOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete method.
type PrivateEndpointConnectionsClientCreateResponse ¶
type PrivateEndpointConnectionsClientCreateResponse struct {
// Concrete proxy resource types can be created by aliasing this type using a specific property type.
PrivateEndpointConnectionResource
}
PrivateEndpointConnectionsClientCreateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreate.
type PrivateEndpointConnectionsClientDeleteResponse ¶
type PrivateEndpointConnectionsClientDeleteResponse struct {
}
PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete.
type PrivateEndpointConnectionsClientGetOptions ¶
type PrivateEndpointConnectionsClientGetOptions struct {
}
PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get method.
type PrivateEndpointConnectionsClientGetResponse ¶
type PrivateEndpointConnectionsClientGetResponse struct {
// Concrete proxy resource types can be created by aliasing this type using a specific property type.
PrivateEndpointConnectionResource
}
PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get.
type PrivateEndpointConnectionsClientListByMongoClusterOptions ¶
type PrivateEndpointConnectionsClientListByMongoClusterOptions struct {
}
PrivateEndpointConnectionsClientListByMongoClusterOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByMongoClusterPager method.
type PrivateEndpointConnectionsClientListByMongoClusterResponse ¶
type PrivateEndpointConnectionsClientListByMongoClusterResponse struct {
// The response of a PrivateEndpointConnectionResource list operation.
PrivateEndpointConnectionResourceListResult
}
PrivateEndpointConnectionsClientListByMongoClusterResponse contains the response from method PrivateEndpointConnectionsClient.NewListByMongoClusterPager.
type PrivateEndpointServiceConnectionStatus ¶
type PrivateEndpointServiceConnectionStatus string
PrivateEndpointServiceConnectionStatus - The private endpoint connection status.
const ( // PrivateEndpointServiceConnectionStatusApproved - Connection approved PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" // PrivateEndpointServiceConnectionStatusPending - Connection waiting for approval or rejection PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" // PrivateEndpointServiceConnectionStatusRejected - Connection Rejected PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" )
func PossiblePrivateEndpointServiceConnectionStatusValues ¶
func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus
PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type.
type PrivateLinkResource ¶
type PrivateLinkResource struct {
// The resource-specific properties for this resource.
Properties *PrivateLinkResourceProperties
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
PrivateLinkResource - Concrete proxy resource types can be created by aliasing this type using a specific property type.
func (PrivateLinkResource) MarshalJSON ¶
func (p PrivateLinkResource) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource.
func (*PrivateLinkResource) UnmarshalJSON ¶
func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource.
type PrivateLinkResourceListResult ¶
type PrivateLinkResourceListResult struct {
// REQUIRED; The PrivateLinkResource items on this page
Value []*PrivateLinkResource
// The link to the next page of items
NextLink *string
}
PrivateLinkResourceListResult - The response of a PrivateLinkResource list operation.
func (PrivateLinkResourceListResult) MarshalJSON ¶
func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult.
func (*PrivateLinkResourceListResult) UnmarshalJSON ¶
func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult.
type PrivateLinkResourceProperties ¶
type PrivateLinkResourceProperties struct {
// The private link resource private link DNS zone name.
RequiredZoneNames []*string
// READ-ONLY; The private link resource group id.
GroupID *string
// READ-ONLY; The private link resource required member names.
RequiredMembers []*string
}
PrivateLinkResourceProperties - Properties of a private link resource.
func (PrivateLinkResourceProperties) MarshalJSON ¶
func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties.
func (*PrivateLinkResourceProperties) UnmarshalJSON ¶
func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties.
type PrivateLinkServiceConnectionState ¶
type PrivateLinkServiceConnectionState struct {
// A message indicating if changes on the service provider require any updates on the consumer.
ActionsRequired *string
// The reason for approval/rejection of the connection.
Description *string
// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service.
Status *PrivateEndpointServiceConnectionStatus
}
PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider.
func (PrivateLinkServiceConnectionState) MarshalJSON ¶
func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState.
func (*PrivateLinkServiceConnectionState) UnmarshalJSON ¶
func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState.
type PrivateLinksClient ¶
type PrivateLinksClient struct {
// contains filtered or unexported fields
}
PrivateLinksClient contains the methods for the PrivateLinks group. Don't use this type directly, use NewPrivateLinksClient() instead.
func NewPrivateLinksClient ¶
func NewPrivateLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinksClient, error)
NewPrivateLinksClient creates a new instance of PrivateLinksClient with the specified values.
- subscriptionID - The ID of the target subscription. The value must be an UUID.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - Contains optional client configuration. Pass nil to accept the default values.
func (*PrivateLinksClient) NewListByMongoClusterPager ¶
func (client *PrivateLinksClient) NewListByMongoClusterPager(resourceGroupName string, mongoClusterName string, options *PrivateLinksClientListByMongoClusterOptions) *runtime.Pager[PrivateLinksClientListByMongoClusterResponse]
NewListByMongoClusterPager - list private links on the given resource
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- options - PrivateLinksClientListByMongoClusterOptions contains the optional parameters for the PrivateLinksClient.NewListByMongoClusterPager method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_PrivateLinkResourceList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewPrivateLinksClient().NewListByMongoClusterPager("TestGroup", "myMongoCluster", 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 = armmongocluster.PrivateLinksClientListByMongoClusterResponse{
// PrivateLinkResourceListResult: armmongocluster.PrivateLinkResourceListResult{
// Value: []*armmongocluster.PrivateLinkResource{
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateLinkResources/MongoCluster"),
// Name: to.Ptr("MongoCluster"),
// Type: to.Ptr("Microsoft.DocumentDB/mongoClusters/privateLinkResources"),
// Properties: &armmongocluster.PrivateLinkResourceProperties{
// GroupID: to.Ptr("MongoCluster"),
// RequiredMembers: []*string{
// to.Ptr("c.p7ex3v2euquypn"),
// },
// RequiredZoneNames: []*string{
// to.Ptr("privatelink.mongocluster.cosmos.azure.com"),
// },
// },
// },
// },
// },
// }
}
}
Output:
type PrivateLinksClientListByMongoClusterOptions ¶
type PrivateLinksClientListByMongoClusterOptions struct {
}
PrivateLinksClientListByMongoClusterOptions contains the optional parameters for the PrivateLinksClient.NewListByMongoClusterPager method.
type PrivateLinksClientListByMongoClusterResponse ¶
type PrivateLinksClientListByMongoClusterResponse struct {
// The response of a PrivateLinkResource list operation.
PrivateLinkResourceListResult
}
PrivateLinksClientListByMongoClusterResponse contains the response from method PrivateLinksClient.NewListByMongoClusterPager.
type PromoteMode ¶ added in v0.2.0
type PromoteMode string
PromoteMode - The mode to apply to a promote operation.
const ( // PromoteModeSwitchover - Promotion will switch the current replica cluster to the primary role and the original primary // will be switched to a replica role, maintaining the replication link. PromoteModeSwitchover PromoteMode = "Switchover" )
func PossiblePromoteModeValues ¶ added in v0.2.0
func PossiblePromoteModeValues() []PromoteMode
PossiblePromoteModeValues returns the possible values for the PromoteMode const type.
type PromoteOption ¶ added in v0.2.0
type PromoteOption string
PromoteOption - The option to apply to a promote operation.
const ( // PromoteOptionForced - Promote option forces the promotion without waiting for the replica to be caught up to the primary. // This can result in data-loss so should only be used during disaster recovery scenarios. PromoteOptionForced PromoteOption = "Forced" )
func PossiblePromoteOptionValues ¶ added in v0.2.0
func PossiblePromoteOptionValues() []PromoteOption
PossiblePromoteOptionValues returns the possible values for the PromoteOption const type.
type PromoteReplicaRequest ¶ added in v0.2.0
type PromoteReplicaRequest struct {
// REQUIRED; The promote option to apply to the operation.
PromoteOption *PromoteOption
// The mode to apply to the promote operation. Value is optional and default value is 'Switchover'.
Mode *PromoteMode
}
PromoteReplicaRequest - Promote replica request properties.
func (PromoteReplicaRequest) MarshalJSON ¶ added in v0.2.0
func (p PromoteReplicaRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PromoteReplicaRequest.
func (*PromoteReplicaRequest) UnmarshalJSON ¶ added in v0.2.0
func (p *PromoteReplicaRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PromoteReplicaRequest.
type Properties ¶
type Properties struct {
// The local administrator properties for the mongo cluster.
Administrator *AdministratorProperties
// The authentication configuration for the cluster.
AuthConfig *AuthConfigProperties
// The backup properties of the mongo cluster.
Backup *BackupProperties
// The compute properties of the mongo cluster.
Compute *ComputeProperties
// The mode to create a mongo cluster.
CreateMode *CreateMode
// The Data API properties of the mongo cluster.
DataAPI *DataAPIProperties
// The encryption configuration for the cluster. Depends on identity being configured.
Encryption *EncryptionProperties
// The high availability properties of the mongo cluster.
HighAvailability *HighAvailabilityProperties
// List of private endpoint connections.
PreviewFeatures []*PreviewFeature
// Whether or not public endpoint access is allowed for this mongo cluster.
PublicNetworkAccess *PublicNetworkAccess
// The parameters to create a replica mongo cluster.
ReplicaParameters *ReplicaParameters
// The parameters to create a point-in-time restore mongo cluster.
RestoreParameters *RestoreParameters
// The Mongo DB server version. Defaults to the latest available version if not specified.
ServerVersion *string
// The sharding properties of the mongo cluster.
Sharding *ShardingProperties
// The storage properties of the mongo cluster.
Storage *StorageProperties
// READ-ONLY; The status of the mongo cluster.
ClusterStatus *Status
// READ-ONLY; The default mongo connection string for the cluster.
ConnectionString *string
// READ-ONLY; The infrastructure version the cluster is provisioned on.
InfrastructureVersion *string
// READ-ONLY; List of private endpoint connections.
PrivateEndpointConnections []*PrivateEndpointConnection
// READ-ONLY; The provisioning state of the mongo cluster.
ProvisioningState *ProvisioningState
// READ-ONLY; The replication properties for the mongo cluster
Replica *ReplicationProperties
}
Properties - The properties of a mongo cluster.
func (Properties) MarshalJSON ¶
func (p Properties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type Properties.
func (*Properties) UnmarshalJSON ¶
func (p *Properties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type Properties.
type ProvisioningState ¶
type ProvisioningState string
ProvisioningState - The provisioning state of the last accepted operation.
const ( // ProvisioningStateCanceled - Resource creation was canceled. ProvisioningStateCanceled ProvisioningState = "Canceled" // ProvisioningStateDropping - A drop operation is in-progress on the resource. ProvisioningStateDropping ProvisioningState = "Dropping" // ProvisioningStateFailed - Resource creation failed. ProvisioningStateFailed ProvisioningState = "Failed" // ProvisioningStateInProgress - An operation is in-progress on the resource. ProvisioningStateInProgress ProvisioningState = "InProgress" // ProvisioningStateSucceeded - Resource has been created. ProvisioningStateSucceeded ProvisioningState = "Succeeded" // ProvisioningStateUpdating - An update operation is in-progress on the resource. ProvisioningStateUpdating ProvisioningState = "Updating" )
func PossibleProvisioningStateValues ¶
func PossibleProvisioningStateValues() []ProvisioningState
PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type.
type PublicNetworkAccess ¶
type PublicNetworkAccess string
PublicNetworkAccess - Whether or not public endpoint access is allowed for this Mongo cluster. Value is optional and default value is 'Enabled'
const ( // PublicNetworkAccessDisabled - If set, the private endpoints are the exclusive access method. PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" // PublicNetworkAccessEnabled - If set, mongo cluster can be accessed through private and public methods. PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" )
func PossiblePublicNetworkAccessValues ¶
func PossiblePublicNetworkAccessValues() []PublicNetworkAccess
PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type.
type Replica ¶ added in v0.2.0
type Replica struct {
// The resource-specific properties for this resource.
Properties *Properties
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
Replica - Represents a mongo cluster replica.
func (Replica) MarshalJSON ¶ added in v0.2.0
MarshalJSON implements the json.Marshaller interface for type Replica.
func (*Replica) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON implements the json.Unmarshaller interface for type Replica.
type ReplicaListResult ¶ added in v0.2.0
type ReplicaListResult struct {
// REQUIRED; The Replica items on this page
Value []*Replica
// The link to the next page of items
NextLink *string
}
ReplicaListResult - The response of a Replica list operation.
func (ReplicaListResult) MarshalJSON ¶ added in v0.2.0
func (r ReplicaListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReplicaListResult.
func (*ReplicaListResult) UnmarshalJSON ¶ added in v0.2.0
func (r *ReplicaListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaListResult.
type ReplicaParameters ¶ added in v0.2.0
type ReplicaParameters struct {
// REQUIRED; The location of the source cluster
SourceLocation *string
// REQUIRED; The id of the replication source cluster.
SourceResourceID *string
}
ReplicaParameters - Parameters used for replica operations.
func (ReplicaParameters) MarshalJSON ¶ added in v0.2.0
func (r ReplicaParameters) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReplicaParameters.
func (*ReplicaParameters) UnmarshalJSON ¶ added in v0.2.0
func (r *ReplicaParameters) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaParameters.
type ReplicasClient ¶ added in v0.2.0
type ReplicasClient struct {
// contains filtered or unexported fields
}
ReplicasClient contains the methods for the Replicas group. Don't use this type directly, use NewReplicasClient() instead.
func NewReplicasClient ¶ added in v0.2.0
func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicasClient, error)
NewReplicasClient creates a new instance of ReplicasClient with the specified values.
- subscriptionID - The ID of the target subscription. The value must be an UUID.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - Contains optional client configuration. Pass nil to accept the default values.
func (*ReplicasClient) NewListByParentPager ¶ added in v0.2.0
func (client *ReplicasClient) NewListByParentPager(resourceGroupName string, mongoClusterName string, options *ReplicasClientListByParentOptions) *runtime.Pager[ReplicasClientListByParentResponse]
NewListByParentPager - List all the replicas for the mongo cluster.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- options - ReplicasClientListByParentOptions contains the optional parameters for the ReplicasClient.NewListByParentPager method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_ReplicaList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewReplicasClient().NewListByParentPager("TestGroup", "myMongoCluster", 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 = armmongocluster.ReplicasClientListByParentResponse{
// ReplicaListResult: armmongocluster.ReplicaListResult{
// Value: []*armmongocluster.Replica{
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myReplicaMongoCluster"),
// Name: to.Ptr("myReplicaMongoCluster"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"),
// Properties: &armmongocluster.Properties{
// },
// },
// },
// },
// }
}
}
Output:
type ReplicasClientListByParentOptions ¶ added in v0.2.0
type ReplicasClientListByParentOptions struct {
}
ReplicasClientListByParentOptions contains the optional parameters for the ReplicasClient.NewListByParentPager method.
type ReplicasClientListByParentResponse ¶ added in v0.2.0
type ReplicasClientListByParentResponse struct {
// The response of a Replica list operation.
ReplicaListResult
}
ReplicasClientListByParentResponse contains the response from method ReplicasClient.NewListByParentPager.
type ReplicationProperties ¶ added in v0.2.0
type ReplicationProperties struct {
// READ-ONLY; The replication link state of the replica cluster.
ReplicationState *ReplicationState
// READ-ONLY; The replication role of the cluster
Role *ReplicationRole
// READ-ONLY; The resource id the source cluster for the replica cluster.
SourceResourceID *string
}
ReplicationProperties - Replica properties of the mongo cluster.
func (ReplicationProperties) MarshalJSON ¶ added in v0.2.0
func (r ReplicationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReplicationProperties.
func (*ReplicationProperties) UnmarshalJSON ¶ added in v0.2.0
func (r *ReplicationProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationProperties.
type ReplicationRole ¶ added in v0.2.0
type ReplicationRole string
ReplicationRole - Replication role of the mongo cluster.
const ( // ReplicationRoleAsyncReplica - The cluster is a local asynchronous replica. ReplicationRoleAsyncReplica ReplicationRole = "AsyncReplica" // ReplicationRoleGeoAsyncReplica - The cluster is a geo-asynchronous replica. ReplicationRoleGeoAsyncReplica ReplicationRole = "GeoAsyncReplica" // ReplicationRolePrimary - The cluster is a primary replica. ReplicationRolePrimary ReplicationRole = "Primary" )
func PossibleReplicationRoleValues ¶ added in v0.2.0
func PossibleReplicationRoleValues() []ReplicationRole
PossibleReplicationRoleValues returns the possible values for the ReplicationRole const type.
type ReplicationState ¶ added in v0.2.0
type ReplicationState string
ReplicationState - The state of the replication link between the replica and source cluster.
const ( // ReplicationStateActive - Replication link is active. ReplicationStateActive ReplicationState = "Active" // ReplicationStateBroken - Replication link is broken and the replica may need to be recreated. ReplicationStateBroken ReplicationState = "Broken" // ReplicationStateCatchup - Replica is catching-up with the primary. This can occur after the replica is created or after // a promotion is triggered. ReplicationStateCatchup ReplicationState = "Catchup" // ReplicationStateProvisioning - Replica and replication link to the primary is being created. ReplicationStateProvisioning ReplicationState = "Provisioning" // ReplicationStateReconfiguring - Replication link is re-configuring due to a promotion event. ReplicationStateReconfiguring ReplicationState = "Reconfiguring" // ReplicationStateUpdating - Replication link is being updated due to a change on the replica or an upgrade. ReplicationStateUpdating ReplicationState = "Updating" )
func PossibleReplicationStateValues ¶ added in v0.2.0
func PossibleReplicationStateValues() []ReplicationState
PossibleReplicationStateValues returns the possible values for the ReplicationState const type.
type RestoreParameters ¶
type RestoreParameters struct {
// UTC point in time to restore a mongo cluster
PointInTimeUTC *time.Time
// Resource ID to locate the source cluster to restore
SourceResourceID *string
}
RestoreParameters - Parameters used for restore operations
func (RestoreParameters) MarshalJSON ¶
func (r RestoreParameters) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type RestoreParameters.
func (*RestoreParameters) UnmarshalJSON ¶
func (r *RestoreParameters) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type RestoreParameters.
type ShardingProperties ¶ added in v1.0.0
type ShardingProperties struct {
// Number of shards to provision on the cluster.
ShardCount *int32
}
ShardingProperties - The sharding properties of the cluster. This includes the shard count and scaling options for the cluster.
func (ShardingProperties) MarshalJSON ¶ added in v1.0.0
func (s ShardingProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ShardingProperties.
func (*ShardingProperties) UnmarshalJSON ¶ added in v1.0.0
func (s *ShardingProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ShardingProperties.
type Status ¶ added in v0.2.0
type Status string
Status - The status of the Mongo cluster resource.
const ( // StatusDropping - The mongo cluster resource is being dropped. StatusDropping Status = "Dropping" // StatusProvisioning - The mongo cluster resource is being provisioned. StatusProvisioning Status = "Provisioning" // StatusReady - The mongo cluster resource is ready for use. StatusReady Status = "Ready" // StatusStarting - The mongo cluster resource is being started. StatusStarting Status = "Starting" // StatusStopped - The mongo cluster resource is stopped. StatusStopped Status = "Stopped" // StatusStopping - The mongo cluster resource is being stopped. StatusStopping Status = "Stopping" // StatusUpdating - The mongo cluster resource is being updated. StatusUpdating Status = "Updating" )
func PossibleStatusValues ¶ added in v0.2.0
func PossibleStatusValues() []Status
PossibleStatusValues returns the possible values for the Status const type.
type StorageProperties ¶ added in v1.0.0
type StorageProperties struct {
// The size of the data disk assigned to each server.
SizeGb *int64
// The type of storage to provision the cluster servers with.
Type *StorageType
}
StorageProperties - The storage properties of the cluster. This includes the data storage size and scaling applied to servers in the cluster.
func (StorageProperties) MarshalJSON ¶ added in v1.0.0
func (s StorageProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type StorageProperties.
func (*StorageProperties) UnmarshalJSON ¶ added in v1.0.0
func (s *StorageProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type StorageProperties.
type StorageType ¶ added in v1.1.0
type StorageType string
StorageType - The type of storage that a mongo cluster can be provisioned with.
const ( // StorageTypePremiumSSD - Premium SSD for high performance workloads. StorageTypePremiumSSD StorageType = "PremiumSSD" // StorageTypePremiumSSDv2 - Premium SSD v2 for very IO-intensive workloads. This is a preview option and has additional limitations. StorageTypePremiumSSDv2 StorageType = "PremiumSSDv2" )
func PossibleStorageTypeValues ¶ added in v1.1.0
func PossibleStorageTypeValues() []StorageType
PossibleStorageTypeValues returns the possible values for the StorageType const type.
type SystemData ¶
type SystemData struct {
// The timestamp of resource creation (UTC).
CreatedAt *time.Time
// The identity that created the resource.
CreatedBy *string
// The type of identity that created the resource.
CreatedByType *CreatedByType
// The timestamp of resource last modification (UTC)
LastModifiedAt *time.Time
// The identity that last modified the resource.
LastModifiedBy *string
// The type of identity that last modified the resource.
LastModifiedByType *CreatedByType
}
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 Update ¶
type Update struct {
// The managed service identities assigned to this resource.
Identity *ManagedServiceIdentity
// The resource-specific properties for this resource.
Properties *UpdateProperties
// Resource tags.
Tags map[string]*string
}
Update - The type used for update operations of the MongoCluster.
func (Update) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Update.
func (*Update) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Update.
type UpdateProperties ¶
type UpdateProperties struct {
// The local administrator properties for the mongo cluster.
Administrator *AdministratorProperties
// The authentication configuration for the cluster.
AuthConfig *AuthConfigProperties
// The backup properties of the mongo cluster.
Backup *BackupProperties
// The compute properties of the mongo cluster.
Compute *ComputeProperties
// The Data API properties of the mongo cluster.
DataAPI *DataAPIProperties
// The encryption configuration for the cluster. Depends on identity being configured.
Encryption *EncryptionProperties
// The high availability properties of the mongo cluster.
HighAvailability *HighAvailabilityProperties
// List of private endpoint connections.
PreviewFeatures []*PreviewFeature
// Whether or not public endpoint access is allowed for this mongo cluster.
PublicNetworkAccess *PublicNetworkAccess
// The Mongo DB server version. Defaults to the latest available version if not specified.
ServerVersion *string
// The sharding properties of the mongo cluster.
Sharding *ShardingProperties
// The storage properties of the mongo cluster.
Storage *StorageProperties
}
UpdateProperties - The updatable properties of the MongoCluster.
func (UpdateProperties) MarshalJSON ¶
func (u UpdateProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type UpdateProperties.
func (*UpdateProperties) UnmarshalJSON ¶
func (u *UpdateProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type UpdateProperties.
type User ¶ added in v1.1.0
type User struct {
// The resource-specific properties for this resource.
Properties *UserProperties
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
User - Represents a Mongo cluster user.
func (User) MarshalJSON ¶ added in v1.1.0
MarshalJSON implements the json.Marshaller interface for type User.
func (*User) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON implements the json.Unmarshaller interface for type User.
type UserAssignedIdentity ¶ added in v1.1.0
type UserAssignedIdentity struct {
// READ-ONLY; The client ID of the assigned identity.
ClientID *string
// READ-ONLY; The principal ID of the assigned identity.
PrincipalID *string
}
UserAssignedIdentity - User assigned identity properties
func (UserAssignedIdentity) MarshalJSON ¶ added in v1.1.0
func (u UserAssignedIdentity) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity.
func (*UserAssignedIdentity) UnmarshalJSON ¶ added in v1.1.0
func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity.
type UserListResult ¶ added in v1.1.0
type UserListResult struct {
// REQUIRED; The User items on this page
Value []*User
// The link to the next page of items
NextLink *string
}
UserListResult - The response of a User list operation.
func (UserListResult) MarshalJSON ¶ added in v1.1.0
func (u UserListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type UserListResult.
func (*UserListResult) UnmarshalJSON ¶ added in v1.1.0
func (u *UserListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type UserListResult.
type UserProperties ¶ added in v1.1.0
type UserProperties struct {
// The user's identity provider definition.
IdentityProvider IdentityProviderClassification
// Database roles that are assigned to the user.
Roles []*DatabaseRole
// READ-ONLY; The provisioning state of the user.
ProvisioningState *ProvisioningState
}
UserProperties - Definition of Mongo user resource on a cluster.
func (UserProperties) MarshalJSON ¶ added in v1.1.0
func (u UserProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type UserProperties.
func (*UserProperties) UnmarshalJSON ¶ added in v1.1.0
func (u *UserProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type UserProperties.
type UserRole ¶ added in v1.1.0
type UserRole string
UserRole - Built-in database role that can be assigned to a user.
const ( // UserRoleRoot - Root role permissions on the target scope. UserRoleRoot UserRole = "root" )
func PossibleUserRoleValues ¶ added in v1.1.0
func PossibleUserRoleValues() []UserRole
PossibleUserRoleValues returns the possible values for the UserRole const type.
type UsersClient ¶ added in v1.1.0
type UsersClient struct {
// contains filtered or unexported fields
}
UsersClient contains the methods for the Users group. Don't use this type directly, use NewUsersClient() instead.
func NewUsersClient ¶ added in v1.1.0
func NewUsersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsersClient, error)
NewUsersClient creates a new instance of UsersClient with the specified values.
- subscriptionID - The ID of the target subscription. The value must be an UUID.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - Contains optional client configuration. Pass nil to accept the default values.
func (*UsersClient) BeginCreateOrUpdate ¶ added in v1.1.0
func (client *UsersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, userName string, resource User, options *UsersClientBeginCreateOrUpdateOptions) (*runtime.Poller[UsersClientCreateOrUpdateResponse], error)
BeginCreateOrUpdate - Creates a new user or updates an existing user on a mongo cluster. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- userName - The name of the mongo cluster user.
- resource - Resource create parameters.
- options - UsersClientBeginCreateOrUpdateOptions contains the optional parameters for the UsersClient.BeginCreateOrUpdate method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_UserCreateOrUpdate.json
package main
import (
"context"
"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/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewUsersClient().BeginCreateOrUpdate(ctx, "TestGroup", "myMongoCluster", "uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu", armmongocluster.User{
Properties: &armmongocluster.UserProperties{
Roles: []*armmongocluster.DatabaseRole{
{
Role: to.Ptr(armmongocluster.UserRoleRoot),
Db: to.Ptr("admin"),
},
},
IdentityProvider: &armmongocluster.EntraIdentityProvider{
Type: to.Ptr(armmongocluster.IdentityProviderTypeMicrosoftEntraID),
Properties: &armmongocluster.EntraIdentityProviderProperties{
PrincipalType: to.Ptr(armmongocluster.EntraPrincipalTypeUser),
},
},
},
}, 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 = armmongocluster.UsersClientCreateOrUpdateResponse{
// User: &armmongocluster.User{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/users/uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"),
// Name: to.Ptr("uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/users"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.UserProperties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateInProgress),
// Roles: []*armmongocluster.DatabaseRole{
// {
// Role: to.Ptr(armmongocluster.UserRoleRoot),
// Db: to.Ptr("admin"),
// },
// },
// IdentityProvider: &armmongocluster.EntraIdentityProvider{
// Type: to.Ptr(armmongocluster.IdentityProviderTypeMicrosoftEntraID),
// Properties: &armmongocluster.EntraIdentityProviderProperties{
// PrincipalType: to.Ptr(armmongocluster.EntraPrincipalTypeUser),
// },
// },
// },
// },
// }
}
Output:
func (*UsersClient) BeginDelete ¶ added in v1.1.0
func (client *UsersClient) BeginDelete(ctx context.Context, resourceGroupName string, mongoClusterName string, userName string, options *UsersClientBeginDeleteOptions) (*runtime.Poller[UsersClientDeleteResponse], error)
BeginDelete - Deletes a mongo cluster user. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- userName - The name of the mongo cluster user.
- options - UsersClientBeginDeleteOptions contains the optional parameters for the UsersClient.BeginDelete method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_UserDelete.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewUsersClient().BeginDelete(ctx, "TestGroup", "myMongoCluster", "uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu", 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 (*UsersClient) Get ¶ added in v1.1.0
func (client *UsersClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, userName string, options *UsersClientGetOptions) (UsersClientGetResponse, error)
Get - Gets the defintion of a Mongo cluster user. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- userName - The name of the mongo cluster user.
- options - UsersClientGetOptions contains the optional parameters for the UsersClient.Get method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_UserGet.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewUsersClient().Get(ctx, "TestGroup", "myMongoCluster", "uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu", 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 = armmongocluster.UsersClientGetResponse{
// User: &armmongocluster.User{
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/users/uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"),
// Name: to.Ptr("uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/users"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.UserProperties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Roles: []*armmongocluster.DatabaseRole{
// {
// Role: to.Ptr(armmongocluster.UserRoleRoot),
// Db: to.Ptr("admin"),
// },
// },
// IdentityProvider: &armmongocluster.EntraIdentityProvider{
// Type: to.Ptr(armmongocluster.IdentityProviderTypeMicrosoftEntraID),
// Properties: &armmongocluster.EntraIdentityProviderProperties{
// PrincipalType: to.Ptr(armmongocluster.EntraPrincipalTypeUser),
// },
// },
// },
// },
// }
}
Output:
func (*UsersClient) NewListByMongoClusterPager ¶ added in v1.1.0
func (client *UsersClient) NewListByMongoClusterPager(resourceGroupName string, mongoClusterName string, options *UsersClientListByMongoClusterOptions) *runtime.Pager[UsersClientListByMongoClusterResponse]
NewListByMongoClusterPager - List all the users on a mongo cluster.
Generated from API version 2025-09-01
- resourceGroupName - The name of the resource group. The name is case insensitive.
- mongoClusterName - The name of the mongo cluster.
- options - UsersClientListByMongoClusterOptions contains the optional parameters for the UsersClient.NewListByMongoClusterPager method.
Example ¶
Generated from example definition: 2025-09-01/MongoClusters_UserList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster"
"log"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsersClient().NewListByMongoClusterPager("TestGroup", "myMongoCluster", 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 = armmongocluster.UsersClientListByMongoClusterResponse{
// UserListResult: armmongocluster.UserListResult{
// Value: []*armmongocluster.User{
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/users/ssssssss-ssss-ssss-ssss-ssssssssssss"),
// Name: to.Ptr("ssssssss-ssss-ssss-ssss-ssssssssssss"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/users"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.UserProperties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Roles: []*armmongocluster.DatabaseRole{
// {
// Role: to.Ptr(armmongocluster.UserRoleRoot),
// Db: to.Ptr("admin"),
// },
// },
// IdentityProvider: &armmongocluster.EntraIdentityProvider{
// Type: to.Ptr(armmongocluster.IdentityProviderTypeMicrosoftEntraID),
// Properties: &armmongocluster.EntraIdentityProviderProperties{
// PrincipalType: to.Ptr(armmongocluster.EntraPrincipalTypeServicePrincipal),
// },
// },
// },
// },
// {
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/users/uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"),
// Name: to.Ptr("uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"),
// Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/users"),
// SystemData: &armmongocluster.SystemData{
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// },
// Properties: &armmongocluster.UserProperties{
// ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded),
// Roles: []*armmongocluster.DatabaseRole{
// {
// Role: to.Ptr(armmongocluster.UserRoleRoot),
// Db: to.Ptr("admin"),
// },
// },
// IdentityProvider: &armmongocluster.EntraIdentityProvider{
// Type: to.Ptr(armmongocluster.IdentityProviderTypeMicrosoftEntraID),
// Properties: &armmongocluster.EntraIdentityProviderProperties{
// PrincipalType: to.Ptr(armmongocluster.EntraPrincipalTypeUser),
// },
// },
// },
// },
// },
// },
// }
}
}
Output:
type UsersClientBeginCreateOrUpdateOptions ¶ added in v1.1.0
type UsersClientBeginCreateOrUpdateOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
UsersClientBeginCreateOrUpdateOptions contains the optional parameters for the UsersClient.BeginCreateOrUpdate method.
type UsersClientBeginDeleteOptions ¶ added in v1.1.0
type UsersClientBeginDeleteOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
UsersClientBeginDeleteOptions contains the optional parameters for the UsersClient.BeginDelete method.
type UsersClientCreateOrUpdateResponse ¶ added in v1.1.0
type UsersClientCreateOrUpdateResponse struct {
// Represents a Mongo cluster user.
User
}
UsersClientCreateOrUpdateResponse contains the response from method UsersClient.BeginCreateOrUpdate.
type UsersClientDeleteResponse ¶ added in v1.1.0
type UsersClientDeleteResponse struct {
}
UsersClientDeleteResponse contains the response from method UsersClient.BeginDelete.
type UsersClientGetOptions ¶ added in v1.1.0
type UsersClientGetOptions struct {
}
UsersClientGetOptions contains the optional parameters for the UsersClient.Get method.
type UsersClientGetResponse ¶ added in v1.1.0
type UsersClientGetResponse struct {
// Represents a Mongo cluster user.
User
}
UsersClientGetResponse contains the response from method UsersClient.Get.
type UsersClientListByMongoClusterOptions ¶ added in v1.1.0
type UsersClientListByMongoClusterOptions struct {
}
UsersClientListByMongoClusterOptions contains the optional parameters for the UsersClient.NewListByMongoClusterPager method.
type UsersClientListByMongoClusterResponse ¶ added in v1.1.0
type UsersClientListByMongoClusterResponse struct {
// The response of a User list operation.
UserListResult
}
UsersClientListByMongoClusterResponse contains the response from method UsersClient.NewListByMongoClusterPager.