diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Azure.ResourceManager.CosmosDB.sln b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Azure.ResourceManager.CosmosDB.sln index 9ae1f8ab8d554..a9fe917991c9d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Azure.ResourceManager.CosmosDB.sln +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Azure.ResourceManager.CosmosDB.sln @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Cosmo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.CosmosDB.Tests", "tests\Azure.ResourceManager.CosmosDB.Tests.csproj", "{3EC07824-4ECC-4909-8F2A-4796B3B157C6}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.CosmosDB.Samples", "samples\Azure.ResourceManager.CosmosDB.Samples.csproj", "{049D538F-4379-460C-B178-1946BE1AD737}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -19,18 +21,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|Any CPU.Build.0 = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x64.ActiveCfg = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x64.Build.0 = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x86.ActiveCfg = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x86.Build.0 = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|Any CPU.ActiveCfg = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|Any CPU.Build.0 = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x64.ActiveCfg = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x64.Build.0 = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x86.ActiveCfg = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x86.Build.0 = Release|Any CPU {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -67,6 +57,18 @@ Global {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|x64.Build.0 = Release|Any CPU {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|x86.ActiveCfg = Release|Any CPU {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|x86.Build.0 = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|Any CPU.Build.0 = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|x64.ActiveCfg = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|x64.Build.0 = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|x86.ActiveCfg = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|x86.Build.0 = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|Any CPU.ActiveCfg = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|Any CPU.Build.0 = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|x64.ActiveCfg = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|x64.Build.0 = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|x86.ActiveCfg = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/CHANGELOG.md b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/CHANGELOG.md index 7028584ddeae8..1285a74c1533e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/CHANGELOG.md +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/CHANGELOG.md @@ -1,21 +1,23 @@ # Release History -## 1.4.0-beta.4 (Unreleased) +## 1.4.0-beta.4 (2023-10-30) ### Features Added -### Breaking Changes - -### Bugs Fixed +- Upgraded api-version tag from 'package-preview-2023-03-15' to 'package-preview-2023-09'. Tag detail available at https://github.com/Azure/azure-rest-api-specs/blob/35215554aef59a30fa709e4b058931101a5ef26b/specification/cosmos-db/resource-manager/readme.md ### Other Changes +- Upgraded Azure.Core from 1.34.0 to 1.35.0 + ## 1.4.0-beta.3 (2023-07-31) ### Features Added + - Updated Microsoft.DocumentDB RP API version to `2023-03-15-preview` - Adds support for Database partition merge operation. - Adds support for Materialized view in Collections. + ## 1.4.0-beta.2 (2023-05-29) ### Features Added @@ -32,6 +34,7 @@ - Upgraded dependent Azure.ResourceManager to 1.6.0. ## 1.4.0-beta.1 (2023-04-28) + ### Features Added - Updated Microsoft.DocumentDB RP API version to `2022-11-15-preview` @@ -183,7 +186,3 @@ This package follows the [new Azure SDK guidelines](https://azure.github.io/azur This package is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). > NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). - - - - diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/api/Azure.ResourceManager.CosmosDB.netstandard2.0.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/api/Azure.ResourceManager.CosmosDB.netstandard2.0.cs index b6e60b8e55f4c..58dc49f05483a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/api/Azure.ResourceManager.CosmosDB.netstandard2.0.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/api/Azure.ResourceManager.CosmosDB.netstandard2.0.cs @@ -1,35 +1,5 @@ namespace Azure.ResourceManager.CosmosDB { - public partial class CassandraClusterBackupResource : Azure.ResourceManager.ArmResource - { - public static readonly Azure.Core.ResourceType ResourceType; - protected CassandraClusterBackupResource() { } - public virtual Azure.ResourceManager.CosmosDB.CassandraClusterBackupResourceData Data { get { throw null; } } - public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string backupId) { throw null; } - public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class CassandraClusterBackupResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - protected CassandraClusterBackupResourceCollection() { } - public virtual Azure.Response Exists(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class CassandraClusterBackupResourceData : Azure.ResourceManager.Models.ResourceData - { - public CassandraClusterBackupResourceData() { } - public System.DateTimeOffset? BackupResourceTimestamp { get { throw null; } set { } } - } public partial class CassandraClusterCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected CassandraClusterCollection() { } @@ -62,15 +32,20 @@ protected CassandraClusterResource() { } public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Deallocate(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeallocateAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Deallocate(Azure.WaitUntil waitUntil, bool? xMsForceDeallocate = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.ResourceManager.ArmOperation Deallocate(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken) { throw null; } + public virtual System.Threading.Tasks.Task DeallocateAsync(Azure.WaitUntil waitUntil, bool? xMsForceDeallocate = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual System.Threading.Tasks.Task DeallocateAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken) { throw null; } public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetCassandraClusterBackupResource(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetCassandraClusterBackupResourceAsync(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.CosmosDB.CassandraClusterBackupResourceCollection GetCassandraClusterBackupResources() { throw null; } + public virtual Azure.Response GetBackup(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupAsync(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBackups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBackupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetCassandraDataCenter(string dataCenterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetCassandraDataCenterAsync(string dataCenterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.CosmosDB.CassandraDataCenterCollection GetCassandraDataCenters() { throw null; } @@ -359,8 +334,10 @@ public CosmosDBAccountData(Azure.Core.AzureLocation location) : base (default(Az public Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy ConsistencyPolicy { get { throw null; } set { } } public System.Collections.Generic.IList Cors { get { throw null; } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? CreateMode { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus? CustomerManagedKeyStatus { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType? DatabaseAccountOfferType { get { throw null; } } public string DefaultIdentity { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel? DefaultPriorityLevel { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? DiagnosticLogEnableFullTextQuery { get { throw null; } set { } } public bool? DisableKeyBasedMetadataWriteAccess { get { throw null; } set { } } public bool? DisableLocalAuth { get { throw null; } set { } } @@ -371,6 +348,7 @@ public CosmosDBAccountData(Azure.Core.AzureLocation location) : base (default(Az public bool? EnableMaterializedViews { get { throw null; } set { } } public bool? EnableMultipleWriteLocations { get { throw null; } set { } } public bool? EnablePartitionMerge { get { throw null; } set { } } + public bool? EnablePriorityBasedExecution { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList FailoverPolicies { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Guid? InstanceId { get { throw null; } } @@ -513,7 +491,6 @@ public static partial class CosmosDBExtensions public static System.Threading.Tasks.Task> CheckNameExistsDatabaseAccountAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetCassandraCluster(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetCassandraClusterAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.ResourceManager.CosmosDB.CassandraClusterBackupResource GetCassandraClusterBackupResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.CosmosDB.CassandraClusterResource GetCassandraClusterResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.CosmosDB.CassandraClusterCollection GetCassandraClusters(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetCassandraClusters(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -1846,10 +1823,10 @@ namespace Azure.ResourceManager.CosmosDB.Models public static partial class ArmCosmosDBModelFactory { public static Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo AutoscaleSettingsResourceInfo(int maxThroughput = 0, Azure.ResourceManager.CosmosDB.Models.ThroughputPolicyResourceInfo autoUpgradeThroughputPolicy = null, int? targetMaxThroughput = default(int?)) { throw null; } - public static Azure.ResourceManager.CosmosDB.CassandraClusterBackupResourceData CassandraClusterBackupResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.DateTimeOffset? backupResourceTimestamp = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupResourceInfo CassandraClusterBackupResourceInfo(string backupId = null, Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState? backupState = default(Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState?), System.DateTimeOffset? backupStartTimestamp = default(System.DateTimeOffset?), System.DateTimeOffset? backupStopTimestamp = default(System.DateTimeOffset?), System.DateTimeOffset? backupExpiryTimestamp = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.CosmosDB.CassandraClusterData CassandraClusterData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.CosmosDB.Models.CassandraClusterProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } - public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterDataCenterNodeItem CassandraClusterDataCenterNodeItem(string address = null, Azure.ResourceManager.CosmosDB.Models.CassandraNodeState? state = default(Azure.ResourceManager.CosmosDB.Models.CassandraNodeState?), string status = null, string cassandraProcessStatus = null, string load = null, System.Collections.Generic.IEnumerable tokens = null, int? size = default(int?), System.Guid? hostId = default(System.Guid?), string rack = null, string timestamp = null, long? diskUsedKB = default(long?), long? diskFreeKB = default(long?), long? memoryUsedKB = default(long?), long? memoryBuffersAndCachedKB = default(long?), long? memoryFreeKB = default(long?), long? memoryTotalKB = default(long?), double? cpuUsage = default(double?)) { throw null; } - public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterProperties CassandraClusterProperties(Azure.ResourceManager.CosmosDB.Models.CassandraProvisioningState? provisioningState = default(Azure.ResourceManager.CosmosDB.Models.CassandraProvisioningState?), string restoreFromBackupId = null, Azure.Core.ResourceIdentifier delegatedManagementSubnetId = null, string cassandraVersion = null, string clusterNameOverride = null, Azure.ResourceManager.CosmosDB.Models.CassandraAuthenticationMethod? authenticationMethod = default(Azure.ResourceManager.CosmosDB.Models.CassandraAuthenticationMethod?), string initialCassandraAdminPassword = null, string prometheusEndpointIPAddress = null, bool? isRepairEnabled = default(bool?), System.Collections.Generic.IEnumerable clientCertificates = null, System.Collections.Generic.IEnumerable externalGossipCertificates = null, System.Collections.Generic.IEnumerable gossipCertificates = null, System.Collections.Generic.IEnumerable externalSeedNodes = null, System.Collections.Generic.IEnumerable seedNodes = null, int? hoursBetweenBackups = default(int?), bool? isDeallocated = default(bool?), bool? isCassandraAuditLoggingEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CassandraError provisionError = null) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterDataCenterNodeItem CassandraClusterDataCenterNodeItem(string address = null, Azure.ResourceManager.CosmosDB.Models.CassandraNodeState? state = default(Azure.ResourceManager.CosmosDB.Models.CassandraNodeState?), string status = null, string cassandraProcessStatus = null, string load = null, System.Collections.Generic.IEnumerable tokens = null, int? size = default(int?), System.Guid? hostId = default(System.Guid?), string rack = null, string timestamp = null, long? diskUsedKB = default(long?), long? diskFreeKB = default(long?), long? memoryUsedKB = default(long?), long? memoryBuffersAndCachedKB = default(long?), long? memoryFreeKB = default(long?), long? memoryTotalKB = default(long?), double? cpuUsage = default(double?), bool? isLatestModel = default(bool?)) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterProperties CassandraClusterProperties(Azure.ResourceManager.CosmosDB.Models.CassandraProvisioningState? provisioningState = default(Azure.ResourceManager.CosmosDB.Models.CassandraProvisioningState?), string restoreFromBackupId = null, Azure.Core.ResourceIdentifier delegatedManagementSubnetId = null, string cassandraVersion = null, string clusterNameOverride = null, Azure.ResourceManager.CosmosDB.Models.CassandraAuthenticationMethod? authenticationMethod = default(Azure.ResourceManager.CosmosDB.Models.CassandraAuthenticationMethod?), string initialCassandraAdminPassword = null, string prometheusEndpointIPAddress = null, bool? isRepairEnabled = default(bool?), System.Collections.Generic.IEnumerable clientCertificates = null, System.Collections.Generic.IEnumerable externalGossipCertificates = null, System.Collections.Generic.IEnumerable gossipCertificates = null, System.Collections.Generic.IEnumerable externalSeedNodes = null, System.Collections.Generic.IEnumerable seedNodes = null, int? hoursBetweenBackups = default(int?), bool? isDeallocated = default(bool?), bool? isCassandraAuditLoggingEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CassandraClusterType? clusterType = default(Azure.ResourceManager.CosmosDB.Models.CassandraClusterType?), Azure.ResourceManager.CosmosDB.Models.CassandraError provisionError = null, System.Collections.Generic.IEnumerable extensions = null, System.Collections.Generic.IEnumerable backupSchedules = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterPublicStatus CassandraClusterPublicStatus(Azure.ETag? etag = default(Azure.ETag?), Azure.ResourceManager.CosmosDB.Models.CassandraReaperStatus reaperStatus = null, System.Collections.Generic.IEnumerable connectionErrors = null, System.Collections.Generic.IEnumerable errors = null, System.Collections.Generic.IEnumerable dataCenters = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterPublicStatusDataCentersItem CassandraClusterPublicStatusDataCentersItem(string name = null, System.Collections.Generic.IEnumerable seedNodes = null, System.Collections.Generic.IEnumerable nodes = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CassandraCommandOutput CassandraCommandOutput(string commandOutput = null) { throw null; } @@ -1866,8 +1843,8 @@ public static partial class ArmCosmosDBModelFactory public static Azure.ResourceManager.CosmosDB.CassandraViewGetResultData CassandraViewGetResultData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.CosmosDB.Models.CassandraViewGetPropertiesResource resource = null, Azure.ResourceManager.CosmosDB.Models.CassandraViewGetPropertiesOptions options = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CheckCosmosDBNameAvailabilityResponse CheckCosmosDBNameAvailabilityResponse(bool? nameAvailable = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBNameUnavailableReason? reason = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBNameUnavailableReason?), string message = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountConnectionString CosmosDBAccountConnectionString(string connectionString = null, string description = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBKind? keyKind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBKind?), Azure.ResourceManager.CosmosDB.Models.CosmosDBType? keyType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBType?)) { throw null; } - public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdateContent(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind? kind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind?), Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy consistencyPolicy = null, System.Collections.Generic.IEnumerable locations = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType databaseAccountOfferType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType), System.Collections.Generic.IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = default(bool?), bool? enableAutomaticFailover = default(bool?), System.Collections.Generic.IEnumerable capabilities = null, System.Collections.Generic.IEnumerable virtualNetworkRules = null, bool? enableMultipleWriteLocations = default(bool?), bool? enableCassandraConnector = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConnectorOffer? connectorOffer = default(Azure.ResourceManager.CosmosDB.Models.ConnectorOffer?), bool? disableKeyBasedMetadataWriteAccess = default(bool?), System.Uri keyVaultKeyUri = null, string defaultIdentity = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess?), bool? isFreeTierEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion? apiServerVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion?), bool? isAnalyticalStorageEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType? analyticalStorageSchemaType = default(Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? createMode = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountBackupPolicy backupPolicy = null, System.Collections.Generic.IEnumerable cors = null, Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass? networkAclBypass = default(Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass?), System.Collections.Generic.IEnumerable networkAclBypassResourceIds = null, Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? diagnosticLogEnableFullTextQuery = default(Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery?), bool? disableLocalAuth = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountRestoreParameters restoreParameters = null, int? capacityTotalThroughputLimit = default(int?), bool? enableMaterializedViews = default(bool?), Azure.ResourceManager.CosmosDB.Models.DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = default(bool?), bool? enableBurstCapacity = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion? minimalTlsVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } - public static Azure.ResourceManager.CosmosDB.CosmosDBAccountData CosmosDBAccountData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind? kind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind?), string provisioningState = null, string documentEndpoint = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType? databaseAccountOfferType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType?), System.Collections.Generic.IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = default(bool?), bool? enableAutomaticFailover = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy consistencyPolicy = null, System.Collections.Generic.IEnumerable capabilities = null, System.Collections.Generic.IEnumerable writeLocations = null, System.Collections.Generic.IEnumerable readLocations = null, System.Collections.Generic.IEnumerable locations = null, System.Collections.Generic.IEnumerable failoverPolicies = null, System.Collections.Generic.IEnumerable virtualNetworkRules = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, bool? enableMultipleWriteLocations = default(bool?), bool? enableCassandraConnector = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConnectorOffer? connectorOffer = default(Azure.ResourceManager.CosmosDB.Models.ConnectorOffer?), bool? disableKeyBasedMetadataWriteAccess = default(bool?), System.Uri keyVaultKeyUri = null, string defaultIdentity = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess?), bool? isFreeTierEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion? apiServerVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion?), bool? isAnalyticalStorageEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType? analyticalStorageSchemaType = default(Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType?), System.Guid? instanceId = default(System.Guid?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? createMode = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountRestoreParameters restoreParameters = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountBackupPolicy backupPolicy = null, System.Collections.Generic.IEnumerable cors = null, Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass? networkAclBypass = default(Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass?), System.Collections.Generic.IEnumerable networkAclBypassResourceIds = null, Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? diagnosticLogEnableFullTextQuery = default(Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery?), bool? disableLocalAuth = default(bool?), int? capacityTotalThroughputLimit = default(int?), bool? enableMaterializedViews = default(bool?), Azure.ResourceManager.CosmosDB.Models.DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = default(bool?), bool? enableBurstCapacity = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion? minimalTlsVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdateContent(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind? kind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind?), Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy consistencyPolicy = null, System.Collections.Generic.IEnumerable locations = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType databaseAccountOfferType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType), System.Collections.Generic.IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = default(bool?), bool? enableAutomaticFailover = default(bool?), System.Collections.Generic.IEnumerable capabilities = null, System.Collections.Generic.IEnumerable virtualNetworkRules = null, bool? enableMultipleWriteLocations = default(bool?), bool? enableCassandraConnector = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConnectorOffer? connectorOffer = default(Azure.ResourceManager.CosmosDB.Models.ConnectorOffer?), bool? disableKeyBasedMetadataWriteAccess = default(bool?), System.Uri keyVaultKeyUri = null, string defaultIdentity = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess?), bool? isFreeTierEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion? apiServerVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion?), bool? isAnalyticalStorageEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType? analyticalStorageSchemaType = default(Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? createMode = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountBackupPolicy backupPolicy = null, System.Collections.Generic.IEnumerable cors = null, Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass? networkAclBypass = default(Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass?), System.Collections.Generic.IEnumerable networkAclBypassResourceIds = null, Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? diagnosticLogEnableFullTextQuery = default(Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery?), bool? disableLocalAuth = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountRestoreParameters restoreParameters = null, int? capacityTotalThroughputLimit = default(int?), bool? enableMaterializedViews = default(bool?), Azure.ResourceManager.CosmosDB.Models.DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = default(bool?), bool? enableBurstCapacity = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion? minimalTlsVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion?), Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus? customerManagedKeyStatus = default(Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus?), bool? enablePriorityBasedExecution = default(bool?), Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel? defaultPriorityLevel = default(Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.CosmosDB.CosmosDBAccountData CosmosDBAccountData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind? kind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind?), string provisioningState = null, string documentEndpoint = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType? databaseAccountOfferType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType?), System.Collections.Generic.IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = default(bool?), bool? enableAutomaticFailover = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy consistencyPolicy = null, System.Collections.Generic.IEnumerable capabilities = null, System.Collections.Generic.IEnumerable writeLocations = null, System.Collections.Generic.IEnumerable readLocations = null, System.Collections.Generic.IEnumerable locations = null, System.Collections.Generic.IEnumerable failoverPolicies = null, System.Collections.Generic.IEnumerable virtualNetworkRules = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, bool? enableMultipleWriteLocations = default(bool?), bool? enableCassandraConnector = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConnectorOffer? connectorOffer = default(Azure.ResourceManager.CosmosDB.Models.ConnectorOffer?), bool? disableKeyBasedMetadataWriteAccess = default(bool?), System.Uri keyVaultKeyUri = null, string defaultIdentity = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess?), bool? isFreeTierEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion? apiServerVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion?), bool? isAnalyticalStorageEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType? analyticalStorageSchemaType = default(Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType?), System.Guid? instanceId = default(System.Guid?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? createMode = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountRestoreParameters restoreParameters = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountBackupPolicy backupPolicy = null, System.Collections.Generic.IEnumerable cors = null, Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass? networkAclBypass = default(Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass?), System.Collections.Generic.IEnumerable networkAclBypassResourceIds = null, Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? diagnosticLogEnableFullTextQuery = default(Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery?), bool? disableLocalAuth = default(bool?), int? capacityTotalThroughputLimit = default(int?), bool? enableMaterializedViews = default(bool?), Azure.ResourceManager.CosmosDB.Models.DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = default(bool?), bool? enableBurstCapacity = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion? minimalTlsVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion?), Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus? customerManagedKeyStatus = default(Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus?), bool? enablePriorityBasedExecution = default(bool?), Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel? defaultPriorityLevel = default(Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKeyList CosmosDBAccountKeyList(string primaryReadonlyMasterKey = null, string secondaryReadonlyMasterKey = null, string primaryMasterKey = null, string secondaryMasterKey = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountLocation CosmosDBAccountLocation(string id = null, Azure.Core.AzureLocation? locationName = default(Azure.Core.AzureLocation?), string documentEndpoint = null, string provisioningState = null, int? failoverPriority = default(int?), bool? isZoneRedundant = default(bool?)) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountReadOnlyKeyList CosmosDBAccountReadOnlyKeyList(string primaryReadonlyMasterKey = null, string secondaryReadonlyMasterKey = null) { throw null; } @@ -1933,7 +1910,7 @@ public static partial class ArmCosmosDBModelFactory public static Azure.ResourceManager.CosmosDB.Models.ExtendedRestorableSqlContainerResourceInfo ExtendedRestorableSqlContainerResourceInfo(string rid = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType? operationType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType?), string eventTimestamp = null, string containerName = null, string containerId = null, Azure.ResourceManager.CosmosDB.Models.RestorableSqlContainerPropertiesResourceContainer container = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.ExtendedRestorableSqlDatabaseResourceInfo ExtendedRestorableSqlDatabaseResourceInfo(string rid = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType? operationType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType?), string eventTimestamp = null, string databaseName = null, string databaseId = null, Azure.ResourceManager.CosmosDB.Models.RestorableSqlDatabasePropertiesResourceDatabase database = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.ExtendedRestorableTableResourceInfo ExtendedRestorableTableResourceInfo(string rid = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType? operationType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType?), string eventTimestamp = null, string tableName = null, string tableId = null) { throw null; } - public static Azure.ResourceManager.CosmosDB.Models.ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsResourceInfo(int? throughput = default(int?), Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string rid = null, float? timestamp = default(float?), Azure.ETag? etag = default(Azure.ETag?)) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsResourceInfo(int? throughput = default(int?), Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string instantMaximumThroughput = null, string softAllowedMaximumThroughput = null, string rid = null, float? timestamp = default(float?), Azure.ETag? etag = default(Azure.ETag?)) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.GraphApiComputeRegionalService GraphApiComputeRegionalService(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus? status = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus?), string graphApiComputeEndpoint = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.GraphApiComputeServiceProperties GraphApiComputeServiceProperties(System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceSize? instanceSize = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceSize?), int? instanceCount = default(int?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus? status = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus?), System.Collections.Generic.IDictionary additionalProperties = null, string graphApiComputeEndpoint = null, System.Collections.Generic.IEnumerable locations = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.GraphResourceGetResultCreateOrUpdateContent GraphResourceGetResultCreateOrUpdateContent(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.Core.ResourceIdentifier resourceId = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig options = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } @@ -1979,7 +1956,7 @@ public static partial class ArmCosmosDBModelFactory public static Azure.ResourceManager.CosmosDB.Models.SqlDedicatedGatewayRegionalService SqlDedicatedGatewayRegionalService(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus? status = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus?), string sqlDedicatedGatewayEndpoint = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.SqlDedicatedGatewayServiceProperties SqlDedicatedGatewayServiceProperties(System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceSize? instanceSize = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceSize?), int? instanceCount = default(int?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus? status = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus?), System.Collections.Generic.IDictionary additionalProperties = null, string sqlDedicatedGatewayEndpoint = null, System.Collections.Generic.IEnumerable locations = null) { throw null; } public static Azure.ResourceManager.CosmosDB.ThroughputSettingData ThroughputSettingData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.CosmosDB.Models.ExtendedThroughputSettingsResourceInfo resource = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } - public static Azure.ResourceManager.CosmosDB.Models.ThroughputSettingsResourceInfo ThroughputSettingsResourceInfo(int? throughput = default(int?), Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.ThroughputSettingsResourceInfo ThroughputSettingsResourceInfo(int? throughput = default(int?), Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string instantMaximumThroughput = null, string softAllowedMaximumThroughput = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.ThroughputSettingsUpdateData ThroughputSettingsUpdateData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.CosmosDB.Models.ThroughputSettingsResourceInfo resource = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } } public partial class AuthenticationMethodLdapProperties @@ -2076,6 +2053,42 @@ public partial class CassandraCertificate public CassandraCertificate() { } public string Pem { get { throw null; } set { } } } + public partial class CassandraClusterBackupResourceInfo + { + internal CassandraClusterBackupResourceInfo() { } + public System.DateTimeOffset? BackupExpiryTimestamp { get { throw null; } } + public string BackupId { get { throw null; } } + public System.DateTimeOffset? BackupStartTimestamp { get { throw null; } } + public Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState? BackupState { get { throw null; } } + public System.DateTimeOffset? BackupStopTimestamp { get { throw null; } } + } + public partial class CassandraClusterBackupSchedule + { + public CassandraClusterBackupSchedule() { } + public string CronExpression { get { throw null; } set { } } + public int? RetentionInHours { get { throw null; } set { } } + public string ScheduleName { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CassandraClusterBackupState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CassandraClusterBackupState(string value) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState Failed { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState Initiated { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState InProgress { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState left, Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState right) { throw null; } + public static implicit operator Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState left, Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState right) { throw null; } + public override string ToString() { throw null; } + } public partial class CassandraClusterDataCenterNodeItem { internal CassandraClusterDataCenterNodeItem() { } @@ -2085,6 +2098,7 @@ internal CassandraClusterDataCenterNodeItem() { } public long? DiskFreeKB { get { throw null; } } public long? DiskUsedKB { get { throw null; } } public System.Guid? HostId { get { throw null; } } + public bool? IsLatestModel { get { throw null; } } public string Load { get { throw null; } } public long? MemoryBuffersAndCachedKB { get { throw null; } } public long? MemoryFreeKB { get { throw null; } } @@ -2107,10 +2121,13 @@ public partial class CassandraClusterProperties { public CassandraClusterProperties() { } public Azure.ResourceManager.CosmosDB.Models.CassandraAuthenticationMethod? AuthenticationMethod { get { throw null; } set { } } + public System.Collections.Generic.IList BackupSchedules { get { throw null; } } public string CassandraVersion { get { throw null; } set { } } public System.Collections.Generic.IList ClientCertificates { get { throw null; } } public string ClusterNameOverride { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.CassandraClusterType? ClusterType { get { throw null; } set { } } public Azure.Core.ResourceIdentifier DelegatedManagementSubnetId { get { throw null; } set { } } + public System.Collections.Generic.IList Extensions { get { throw null; } } public System.Collections.Generic.IList ExternalGossipCertificates { get { throw null; } } public System.Collections.Generic.IList ExternalSeedNodes { get { throw null; } } public System.Collections.Generic.IReadOnlyList GossipCertificates { get { throw null; } } @@ -2141,6 +2158,24 @@ internal CassandraClusterPublicStatusDataCentersItem() { } public System.Collections.Generic.IReadOnlyList Nodes { get { throw null; } } public System.Collections.Generic.IReadOnlyList SeedNodes { get { throw null; } } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CassandraClusterType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CassandraClusterType(string value) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterType NonProduction { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterType Production { get { throw null; } } + public bool Equals(Azure.ResourceManager.CosmosDB.Models.CassandraClusterType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CosmosDB.Models.CassandraClusterType left, Azure.ResourceManager.CosmosDB.Models.CassandraClusterType right) { throw null; } + public static implicit operator Azure.ResourceManager.CosmosDB.Models.CassandraClusterType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CosmosDB.Models.CassandraClusterType left, Azure.ResourceManager.CosmosDB.Models.CassandraClusterType right) { throw null; } + public override string ToString() { throw null; } + } public partial class CassandraColumn { public CassandraColumn() { } @@ -2457,6 +2492,7 @@ public partial class CosmosCassandraDataTransferDataSourceSink : Azure.ResourceM { public CosmosCassandraDataTransferDataSourceSink(string keyspaceName, string tableName) { } public string KeyspaceName { get { throw null; } set { } } + public string RemoteAccountName { get { throw null; } set { } } public string TableName { get { throw null; } set { } } } public abstract partial class CosmosDBAccountBackupPolicy @@ -2517,8 +2553,10 @@ public CosmosDBAccountCreateOrUpdateContent(Azure.Core.AzureLocation location, S public Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy ConsistencyPolicy { get { throw null; } set { } } public System.Collections.Generic.IList Cors { get { throw null; } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? CreateMode { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus? CustomerManagedKeyStatus { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType DatabaseAccountOfferType { get { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] set { } } public string DefaultIdentity { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel? DefaultPriorityLevel { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? DiagnosticLogEnableFullTextQuery { get { throw null; } set { } } public bool? DisableKeyBasedMetadataWriteAccess { get { throw null; } set { } } public bool? DisableLocalAuth { get { throw null; } set { } } @@ -2528,6 +2566,7 @@ public CosmosDBAccountCreateOrUpdateContent(Azure.Core.AzureLocation location, S public bool? EnableMaterializedViews { get { throw null; } set { } } public bool? EnableMultipleWriteLocations { get { throw null; } set { } } public bool? EnablePartitionMerge { get { throw null; } set { } } + public bool? EnablePriorityBasedExecution { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList IPRules { get { throw null; } } public bool? IsAnalyticalStorageEnabled { get { throw null; } set { } } @@ -2627,7 +2666,9 @@ public CosmosDBAccountPatch() { } public Azure.ResourceManager.CosmosDB.Models.ConnectorOffer? ConnectorOffer { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy ConsistencyPolicy { get { throw null; } set { } } public System.Collections.Generic.IList Cors { get { throw null; } } + public Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus? CustomerManagedKeyStatus { get { throw null; } set { } } public string DefaultIdentity { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel? DefaultPriorityLevel { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? DiagnosticLogEnableFullTextQuery { get { throw null; } set { } } public bool? DisableKeyBasedMetadataWriteAccess { get { throw null; } set { } } public bool? DisableLocalAuth { get { throw null; } set { } } @@ -2637,6 +2678,7 @@ public CosmosDBAccountPatch() { } public bool? EnableMaterializedViews { get { throw null; } set { } } public bool? EnableMultipleWriteLocations { get { throw null; } set { } } public bool? EnablePartitionMerge { get { throw null; } set { } } + public bool? EnablePriorityBasedExecution { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList IPRules { get { throw null; } } public bool? IsAnalyticalStorageEnabled { get { throw null; } set { } } @@ -3144,6 +3186,7 @@ public CosmosDBPrivateLinkServiceConnectionStateProperty() { } public CosmosDBPublicNetworkAccess(string value) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess Disabled { get { throw null; } } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess Enabled { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess SecuredByPerimeter { get { throw null; } } public bool Equals(Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } @@ -3537,12 +3580,41 @@ public partial class CosmosMongoDataTransferDataSourceSink : Azure.ResourceManag public CosmosMongoDataTransferDataSourceSink(string databaseName, string collectionName) { } public string CollectionName { get { throw null; } set { } } public string DatabaseName { get { throw null; } set { } } + public string RemoteAccountName { get { throw null; } set { } } } public partial class CosmosSqlDataTransferDataSourceSink : Azure.ResourceManager.CosmosDB.Models.DataTransferDataSourceSink { public CosmosSqlDataTransferDataSourceSink(string databaseName, string containerName) { } public string ContainerName { get { throw null; } set { } } public string DatabaseName { get { throw null; } set { } } + public string RemoteAccountName { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CustomerManagedKeyStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CustomerManagedKeyStatus(string value) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToTheConfiguredCustomerManagedKeyConfirmed { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAccessRulesAreBlockingOutboundRequestsToTheAzureKeyVaultServiceForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide4016 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountHasAnUndefinedDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInvalidAzureCosmosDBDefaultIdentity4015 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountSKeyVaultKeyUriDoesNotFollowTheExpectedFormatForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideImproperSyntaxDetectedOnTheKeyVaultUriProperty4006 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToObtainTheAADAuthenticationTokenForTheAccountSDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureActiveDirectoryTokenAcquisitionError4000 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToWrapOrUnwrapTheKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInternalUnwrappingProcedureError4005 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureKeyVaultDnsNameSpecifiedByTheAccountSKeyvaultkeyuriPropertyCouldNotBeResolvedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideUnableToResolveTheKeyVaultsDns4009 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentAzureKeyVaultWasNotFoundForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4017 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentKeyIsNotFoundOnTheSpecifiedKeyVaultForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4003 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCurrentDefaultIdentityNoLongerHasPermissionToTheAssociatedKeyVaultKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideDefaultIdentityIsUnauthorizedToAccessTheAzureKeyVaultKey4002 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide { get { throw null; } } + public bool Equals(Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus left, Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus left, Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus right) { throw null; } + public override string ToString() { throw null; } } public partial class DatabaseAccountKeysMetadata { @@ -3597,6 +3669,24 @@ public enum DefaultConsistencyLevel Strong = 3, ConsistentPrefix = 4, } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DefaultPriorityLevel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DefaultPriorityLevel(string value) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel High { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel Low { get { throw null; } } + public bool Equals(Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel left, Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel right) { throw null; } + public static implicit operator Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel left, Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel right) { throw null; } + public override string ToString() { throw null; } + } public enum EnableFullTextQuery { None = 0, @@ -4259,8 +4349,10 @@ public partial class ThroughputSettingsResourceInfo { public ThroughputSettingsResourceInfo() { } public Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo AutoscaleSettings { get { throw null; } set { } } + public string InstantMaximumThroughput { get { throw null; } } public string MinimumThroughput { get { throw null; } } public string OfferReplacePending { get { throw null; } } + public string SoftAllowedMaximumThroughput { get { throw null; } } public int? Throughput { get { throw null; } set { } } } public partial class ThroughputSettingsUpdateData : Azure.ResourceManager.Models.TrackedResourceData diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/assets.json b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/assets.json index 89099a3ac05bf..15c32c0cab960 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/assets.json +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/cosmosdb/Azure.ResourceManager.CosmosDB", - "Tag": "net/cosmosdb/Azure.ResourceManager.CosmosDB_136ec94563" + "Tag": "net/cosmosdb/Azure.ResourceManager.CosmosDB_7872c0dcb8" } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Azure.ResourceManager.CosmosDB.Samples.csproj b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Azure.ResourceManager.CosmosDB.Samples.csproj new file mode 100644 index 0000000000000..3910747143189 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Azure.ResourceManager.CosmosDB.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterCollection.cs new file mode 100644 index 0000000000000..a94b83f83a5d6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterCollection.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraClusterCollection + { + // CosmosDBManagedCassandraClusterListByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBManagedCassandraClusterListByResourceGroup() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterListByResourceGroup.json + // this example is just showing the usage of "CassandraClusters_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CassandraClusterResource + CassandraClusterCollection collection = resourceGroupResource.GetCassandraClusters(); + + // invoke the operation and iterate over the result + await foreach (CassandraClusterResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraClusterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBManagedCassandraClusterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterGet.json + // this example is just showing the usage of "CassandraClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CassandraClusterResource + CassandraClusterCollection collection = resourceGroupResource.GetCassandraClusters(); + + // invoke the operation + string clusterName = "cassandra-prod"; + CassandraClusterResource result = await collection.GetAsync(clusterName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBManagedCassandraClusterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBManagedCassandraClusterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterGet.json + // this example is just showing the usage of "CassandraClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CassandraClusterResource + CassandraClusterCollection collection = resourceGroupResource.GetCassandraClusters(); + + // invoke the operation + string clusterName = "cassandra-prod"; + bool result = await collection.ExistsAsync(clusterName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBManagedCassandraClusterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBManagedCassandraClusterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterGet.json + // this example is just showing the usage of "CassandraClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CassandraClusterResource + CassandraClusterCollection collection = resourceGroupResource.GetCassandraClusters(); + + // invoke the operation + string clusterName = "cassandra-prod"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + CassandraClusterResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBManagedCassandraClusterCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBManagedCassandraClusterCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterCreate.json + // this example is just showing the usage of "CassandraClusters_CreateUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CassandraClusterResource + CassandraClusterCollection collection = resourceGroupResource.GetCassandraClusters(); + + // invoke the operation + string clusterName = "cassandra-prod"; + CassandraClusterData data = new CassandraClusterData(new AzureLocation("West US")) + { + Properties = new CassandraClusterProperties() + { + DelegatedManagementSubnetId = new ResourceIdentifier("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management"), + CassandraVersion = "3.11", + ClusterNameOverride = "ClusterNameIllegalForAzureResource", + AuthenticationMethod = CassandraAuthenticationMethod.Cassandra, + InitialCassandraAdminPassword = "mypassword", + ClientCertificates = +{ +new CassandraCertificate() +{ +Pem = "-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----", +} +}, + ExternalGossipCertificates = +{ +new CassandraCertificate() +{ +Pem = "-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----", +} +}, + ExternalSeedNodes = +{ +new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.2", +},new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.3", +},new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.4", +} +}, + HoursBetweenBackups = 24, + }, + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, data); + CassandraClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterResource.cs new file mode 100644 index 0000000000000..2163d3ab672ca --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterResource.cs @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraClusterResource + { + // CosmosDBManagedCassandraClusterListBySubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetCassandraClusters_CosmosDBManagedCassandraClusterListBySubscription() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterListBySubscription.json + // this example is just showing the usage of "CassandraClusters_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (CassandraClusterResource item in subscriptionResource.GetCassandraClustersAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraClusterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBManagedCassandraClusterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterGet.json + // this example is just showing the usage of "CassandraClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + CassandraClusterResource result = await cassandraCluster.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBManagedCassandraClusterDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBManagedCassandraClusterDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterDelete.json + // this example is just showing the usage of "CassandraClusters_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + await cassandraCluster.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraClusterPatch + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBManagedCassandraClusterPatch() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterPatch.json + // this example is just showing the usage of "CassandraClusters_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + CassandraClusterData data = new CassandraClusterData(new AzureLocation("placeholder")) + { + Properties = new CassandraClusterProperties() + { + AuthenticationMethod = CassandraAuthenticationMethod.None, + ExternalGossipCertificates = +{ +new CassandraCertificate() +{ +Pem = "-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----", +} +}, + ExternalSeedNodes = +{ +new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.2", +},new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.3", +},new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.4", +} +}, + HoursBetweenBackups = 12, + }, + Tags = +{ +["owner"] = "mike", +}, + }; + ArmOperation lro = await cassandraCluster.UpdateAsync(WaitUntil.Completed, data); + CassandraClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBManagedCassandraCommand + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task InvokeCommand_CosmosDBManagedCassandraCommand() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraCommand.json + // this example is just showing the usage of "CassandraClusters_InvokeCommand" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + CassandraCommandPostBody body = new CassandraCommandPostBody("nodetool", "10.0.1.12") + { + Arguments = +{ +["status"] = "", +}, + }; + ArmOperation lro = await cassandraCluster.InvokeCommandAsync(WaitUntil.Completed, body); + CassandraCommandOutput result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBManagedCassandraBackupsList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetBackups_CosmosDBManagedCassandraBackupsList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraBackupsList.json + // this example is just showing the usage of "CassandraClusters_ListBackups" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation and iterate over the result + await foreach (CassandraClusterBackupResourceInfo item in cassandraCluster.GetBackupsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraBackup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetBackup_CosmosDBManagedCassandraBackup() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraBackup.json + // this example is just showing the usage of "CassandraClusters_GetBackup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + string backupId = "1611250348"; + CassandraClusterBackupResourceInfo result = await cassandraCluster.GetBackupAsync(backupId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBManagedCassandraClusterDeallocate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Deallocate_CosmosDBManagedCassandraClusterDeallocate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterDeallocate.json + // this example is just showing the usage of "CassandraClusters_Deallocate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + await cassandraCluster.DeallocateAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraClusterStart + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Start_CosmosDBManagedCassandraClusterStart() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterStart.json + // this example is just showing the usage of "CassandraClusters_Start" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + await cassandraCluster.StartAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraStatus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Status_CosmosDBManagedCassandraStatus() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraStatus.json + // this example is just showing the usage of "CassandraClusters_Status" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + CassandraClusterPublicStatus result = await cassandraCluster.StatusAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterCollection.cs new file mode 100644 index 0000000000000..9ed13ce8003a5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterCollection.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraDataCenterCollection + { + // CosmosDBManagedCassandraDataCenterList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBManagedCassandraDataCenterList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterList.json + // this example is just showing the usage of "CassandraDataCenters_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // get the collection of this CassandraDataCenterResource + CassandraDataCenterCollection collection = cassandraCluster.GetCassandraDataCenters(); + + // invoke the operation and iterate over the result + await foreach (CassandraDataCenterResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraDataCenterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBManagedCassandraDataCenterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterGet.json + // this example is just showing the usage of "CassandraDataCenters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // get the collection of this CassandraDataCenterResource + CassandraDataCenterCollection collection = cassandraCluster.GetCassandraDataCenters(); + + // invoke the operation + string dataCenterName = "dc1"; + CassandraDataCenterResource result = await collection.GetAsync(dataCenterName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBManagedCassandraDataCenterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBManagedCassandraDataCenterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterGet.json + // this example is just showing the usage of "CassandraDataCenters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // get the collection of this CassandraDataCenterResource + CassandraDataCenterCollection collection = cassandraCluster.GetCassandraDataCenters(); + + // invoke the operation + string dataCenterName = "dc1"; + bool result = await collection.ExistsAsync(dataCenterName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBManagedCassandraDataCenterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBManagedCassandraDataCenterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterGet.json + // this example is just showing the usage of "CassandraDataCenters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // get the collection of this CassandraDataCenterResource + CassandraDataCenterCollection collection = cassandraCluster.GetCassandraDataCenters(); + + // invoke the operation + string dataCenterName = "dc1"; + NullableResponse response = await collection.GetIfExistsAsync(dataCenterName); + CassandraDataCenterResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBManagedCassandraDataCenterCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBManagedCassandraDataCenterCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterCreate.json + // this example is just showing the usage of "CassandraDataCenters_CreateUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // get the collection of this CassandraDataCenterResource + CassandraDataCenterCollection collection = cassandraCluster.GetCassandraDataCenters(); + + // invoke the operation + string dataCenterName = "dc1"; + CassandraDataCenterData data = new CassandraDataCenterData() + { + Properties = new CassandraDataCenterProperties() + { + DataCenterLocation = new AzureLocation("West US 2"), + DelegatedSubnetId = new ResourceIdentifier("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet"), + NodeCount = 9, + Base64EncodedCassandraYamlFragment = "Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA=", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataCenterName, data); + CassandraDataCenterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterResource.cs new file mode 100644 index 0000000000000..bb18fd5eef376 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterResource.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraDataCenterResource + { + // CosmosDBManagedCassandraDataCenterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBManagedCassandraDataCenterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterGet.json + // this example is just showing the usage of "CassandraDataCenters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraDataCenterResource created on azure + // for more information of creating CassandraDataCenterResource, please refer to the document of CassandraDataCenterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + string dataCenterName = "dc1"; + ResourceIdentifier cassandraDataCenterResourceId = CassandraDataCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, dataCenterName); + CassandraDataCenterResource cassandraDataCenter = client.GetCassandraDataCenterResource(cassandraDataCenterResourceId); + + // invoke the operation + CassandraDataCenterResource result = await cassandraDataCenter.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBManagedCassandraDataCenterDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBManagedCassandraDataCenterDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterDelete.json + // this example is just showing the usage of "CassandraDataCenters_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraDataCenterResource created on azure + // for more information of creating CassandraDataCenterResource, please refer to the document of CassandraDataCenterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + string dataCenterName = "dc1"; + ResourceIdentifier cassandraDataCenterResourceId = CassandraDataCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, dataCenterName); + CassandraDataCenterResource cassandraDataCenter = client.GetCassandraDataCenterResource(cassandraDataCenterResourceId); + + // invoke the operation + await cassandraDataCenter.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraDataCenterUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBManagedCassandraDataCenterUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterPatch.json + // this example is just showing the usage of "CassandraDataCenters_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraDataCenterResource created on azure + // for more information of creating CassandraDataCenterResource, please refer to the document of CassandraDataCenterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + string dataCenterName = "dc1"; + ResourceIdentifier cassandraDataCenterResourceId = CassandraDataCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, dataCenterName); + CassandraDataCenterResource cassandraDataCenter = client.GetCassandraDataCenterResource(cassandraDataCenterResourceId); + + // invoke the operation + CassandraDataCenterData data = new CassandraDataCenterData() + { + Properties = new CassandraDataCenterProperties() + { + DataCenterLocation = new AzureLocation("West US 2"), + DelegatedSubnetId = new ResourceIdentifier("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet"), + NodeCount = 9, + Base64EncodedCassandraYamlFragment = "Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA=", + }, + }; + ArmOperation lro = await cassandraDataCenter.UpdateAsync(WaitUntil.Completed, data); + CassandraDataCenterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceCollection.cs new file mode 100644 index 0000000000000..34b0be10df015 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceCollection.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraKeyspaceCollection + { + // CosmosDBCassandraKeyspaceList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBCassandraKeyspaceList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceList.json + // this example is just showing the usage of "CassandraResources_ListCassandraKeyspaces" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CassandraKeyspaceResource + CassandraKeyspaceCollection collection = cosmosDBAccount.GetCassandraKeyspaces(); + + // invoke the operation and iterate over the result + await foreach (CassandraKeyspaceResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCassandraKeyspaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraKeyspaceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CassandraKeyspaceResource + CassandraKeyspaceCollection collection = cosmosDBAccount.GetCassandraKeyspaces(); + + // invoke the operation + string keyspaceName = "keyspaceName"; + CassandraKeyspaceResource result = await collection.GetAsync(keyspaceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBCassandraKeyspaceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CassandraKeyspaceResource + CassandraKeyspaceCollection collection = cosmosDBAccount.GetCassandraKeyspaces(); + + // invoke the operation + string keyspaceName = "keyspaceName"; + bool result = await collection.ExistsAsync(keyspaceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBCassandraKeyspaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBCassandraKeyspaceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CassandraKeyspaceResource + CassandraKeyspaceCollection collection = cosmosDBAccount.GetCassandraKeyspaces(); + + // invoke the operation + string keyspaceName = "keyspaceName"; + NullableResponse response = await collection.GetIfExistsAsync(keyspaceName); + CassandraKeyspaceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBCassandraKeyspaceCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraKeyspaceCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CassandraKeyspaceResource + CassandraKeyspaceCollection collection = cosmosDBAccount.GetCassandraKeyspaces(); + + // invoke the operation + string keyspaceName = "keyspaceName"; + CassandraKeyspaceCreateOrUpdateContent content = new CassandraKeyspaceCreateOrUpdateContent(new AzureLocation("West US"), new CassandraKeyspaceResourceInfo("keyspaceName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, keyspaceName, content); + CassandraKeyspaceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceResource.cs new file mode 100644 index 0000000000000..2efe3ed9802bb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceResource.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraKeyspaceResource + { + // CosmosDBCassandraKeyspaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraKeyspaceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // invoke the operation + CassandraKeyspaceResource result = await cassandraKeyspace.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBCassandraKeyspaceCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // invoke the operation + CassandraKeyspaceCreateOrUpdateContent content = new CassandraKeyspaceCreateOrUpdateContent(new AzureLocation("West US"), new CassandraKeyspaceResourceInfo("keyspaceName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cassandraKeyspace.UpdateAsync(WaitUntil.Completed, content); + CassandraKeyspaceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBCassandraKeyspaceDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceDelete.json + // this example is just showing the usage of "CassandraResources_DeleteCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // invoke the operation + await cassandraKeyspace.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceThroughputSettingResource.cs new file mode 100644 index 0000000000000..eb749dd0880eb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceThroughputSettingResource.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraKeyspaceThroughputSettingResource + { + // CosmosDBCassandraKeyspaceThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraKeyspaceThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceThroughputGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraKeyspaceThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceThroughputSettingResource created on azure + // for more information of creating CassandraKeyspaceThroughputSettingResource, please refer to the document of CassandraKeyspaceThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceThroughputSettingResourceId = CassandraKeyspaceThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceThroughputSettingResource cassandraKeyspaceThroughputSetting = client.GetCassandraKeyspaceThroughputSettingResource(cassandraKeyspaceThroughputSettingResourceId); + + // invoke the operation + CassandraKeyspaceThroughputSettingResource result = await cassandraKeyspaceThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraKeyspaceThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceThroughputUpdate.json + // this example is just showing the usage of "CassandraResources_UpdateCassandraKeyspaceThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceThroughputSettingResource created on azure + // for more information of creating CassandraKeyspaceThroughputSettingResource, please refer to the document of CassandraKeyspaceThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceThroughputSettingResourceId = CassandraKeyspaceThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceThroughputSettingResource cassandraKeyspaceThroughputSetting = client.GetCassandraKeyspaceThroughputSettingResource(cassandraKeyspaceThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cassandraKeyspaceThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CassandraKeyspaceThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraKeyspaceToAutoscale_CosmosDBCassandraKeyspaceMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceMigrateToAutoscale.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraKeyspaceToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceThroughputSettingResource created on azure + // for more information of creating CassandraKeyspaceThroughputSettingResource, please refer to the document of CassandraKeyspaceThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceThroughputSettingResourceId = CassandraKeyspaceThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceThroughputSettingResource cassandraKeyspaceThroughputSetting = client.GetCassandraKeyspaceThroughputSettingResource(cassandraKeyspaceThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraKeyspaceThroughputSetting.MigrateCassandraKeyspaceToAutoscaleAsync(WaitUntil.Completed); + CassandraKeyspaceThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraKeyspaceToManualThroughput_CosmosDBCassandraKeyspaceMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceMigrateToManualThroughput.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraKeyspaceToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceThroughputSettingResource created on azure + // for more information of creating CassandraKeyspaceThroughputSettingResource, please refer to the document of CassandraKeyspaceThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceThroughputSettingResourceId = CassandraKeyspaceThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceThroughputSettingResource cassandraKeyspaceThroughputSetting = client.GetCassandraKeyspaceThroughputSettingResource(cassandraKeyspaceThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraKeyspaceThroughputSetting.MigrateCassandraKeyspaceToManualThroughputAsync(WaitUntil.Completed); + CassandraKeyspaceThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableCollection.cs new file mode 100644 index 0000000000000..c2398a43c25ef --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableCollection.cs @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraTableCollection + { + // CosmosDBCassandraTableList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBCassandraTableList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableList.json + // this example is just showing the usage of "CassandraResources_ListCassandraTables" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraTableResource + CassandraTableCollection collection = cassandraKeyspace.GetCassandraTables(); + + // invoke the operation and iterate over the result + await foreach (CassandraTableResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCassandraTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraTableResource + CassandraTableCollection collection = cassandraKeyspace.GetCassandraTables(); + + // invoke the operation + string tableName = "tableName"; + CassandraTableResource result = await collection.GetAsync(tableName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBCassandraTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraTableResource + CassandraTableCollection collection = cassandraKeyspace.GetCassandraTables(); + + // invoke the operation + string tableName = "tableName"; + bool result = await collection.ExistsAsync(tableName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBCassandraTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBCassandraTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraTableResource + CassandraTableCollection collection = cassandraKeyspace.GetCassandraTables(); + + // invoke the operation + string tableName = "tableName"; + NullableResponse response = await collection.GetIfExistsAsync(tableName); + CassandraTableResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBCassandraTableCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraTableCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraTableResource + CassandraTableCollection collection = cassandraKeyspace.GetCassandraTables(); + + // invoke the operation + string tableName = "tableName"; + CassandraTableCreateOrUpdateContent content = new CassandraTableCreateOrUpdateContent(new AzureLocation("West US"), new CassandraTableResourceInfo("tableName") + { + DefaultTtl = 100, + Schema = new CassandraSchema() + { + Columns = +{ +new CassandraColumn() +{ +Name = "columnA", +CassandraColumnType = "Ascii", +} +}, + PartitionKeys = +{ +new CassandraPartitionKey() +{ +Name = "columnA", +} +}, + ClusterKeys = +{ +new CassandraClusterKey() +{ +Name = "columnA", +OrderBy = "Asc", +} +}, + }, + AnalyticalStorageTtl = 500, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, tableName, content); + CassandraTableResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableResource.cs new file mode 100644 index 0000000000000..ff6d5b5b245b9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableResource.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraTableResource + { + // CosmosDBCassandraTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableResource created on azure + // for more information of creating CassandraTableResource, please refer to the document of CassandraTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableResourceId = CassandraTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableResource cassandraTable = client.GetCassandraTableResource(cassandraTableResourceId); + + // invoke the operation + CassandraTableResource result = await cassandraTable.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBCassandraTableCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableResource created on azure + // for more information of creating CassandraTableResource, please refer to the document of CassandraTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableResourceId = CassandraTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableResource cassandraTable = client.GetCassandraTableResource(cassandraTableResourceId); + + // invoke the operation + CassandraTableCreateOrUpdateContent content = new CassandraTableCreateOrUpdateContent(new AzureLocation("West US"), new CassandraTableResourceInfo("tableName") + { + DefaultTtl = 100, + Schema = new CassandraSchema() + { + Columns = +{ +new CassandraColumn() +{ +Name = "columnA", +CassandraColumnType = "Ascii", +} +}, + PartitionKeys = +{ +new CassandraPartitionKey() +{ +Name = "columnA", +} +}, + ClusterKeys = +{ +new CassandraClusterKey() +{ +Name = "columnA", +OrderBy = "Asc", +} +}, + }, + AnalyticalStorageTtl = 500, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cassandraTable.UpdateAsync(WaitUntil.Completed, content); + CassandraTableResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBCassandraTableDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableDelete.json + // this example is just showing the usage of "CassandraResources_DeleteCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableResource created on azure + // for more information of creating CassandraTableResource, please refer to the document of CassandraTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableResourceId = CassandraTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableResource cassandraTable = client.GetCassandraTableResource(cassandraTableResourceId); + + // invoke the operation + await cassandraTable.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableThroughputSettingResource.cs new file mode 100644 index 0000000000000..842bb0fc3c552 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableThroughputSettingResource.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraTableThroughputSettingResource + { + // CosmosDBCassandraTableThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraTableThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableThroughputGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraTableThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableThroughputSettingResource created on azure + // for more information of creating CassandraTableThroughputSettingResource, please refer to the document of CassandraTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableThroughputSettingResourceId = CassandraTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableThroughputSettingResource cassandraTableThroughputSetting = client.GetCassandraTableThroughputSettingResource(cassandraTableThroughputSettingResourceId); + + // invoke the operation + CassandraTableThroughputSettingResource result = await cassandraTableThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraTableThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableThroughputUpdate.json + // this example is just showing the usage of "CassandraResources_UpdateCassandraTableThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableThroughputSettingResource created on azure + // for more information of creating CassandraTableThroughputSettingResource, please refer to the document of CassandraTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableThroughputSettingResourceId = CassandraTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableThroughputSettingResource cassandraTableThroughputSetting = client.GetCassandraTableThroughputSettingResource(cassandraTableThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cassandraTableThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CassandraTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraTableToAutoscale_CosmosDBCassandraTableMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableMigrateToAutoscale.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraTableToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableThroughputSettingResource created on azure + // for more information of creating CassandraTableThroughputSettingResource, please refer to the document of CassandraTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableThroughputSettingResourceId = CassandraTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableThroughputSettingResource cassandraTableThroughputSetting = client.GetCassandraTableThroughputSettingResource(cassandraTableThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraTableThroughputSetting.MigrateCassandraTableToAutoscaleAsync(WaitUntil.Completed); + CassandraTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraTableToManualThroughput_CosmosDBCassandraTableMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableMigrateToManualThroughput.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraTableToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableThroughputSettingResource created on azure + // for more information of creating CassandraTableThroughputSettingResource, please refer to the document of CassandraTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableThroughputSettingResourceId = CassandraTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableThroughputSettingResource cassandraTableThroughputSetting = client.GetCassandraTableThroughputSettingResource(cassandraTableThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraTableThroughputSetting.MigrateCassandraTableToManualThroughputAsync(WaitUntil.Completed); + CassandraTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultCollection.cs new file mode 100644 index 0000000000000..c3b5a5f84f239 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultCollection.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraViewGetResultCollection + { + // CosmosDBCassandraViewList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBCassandraViewList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewList.json + // this example is just showing the usage of "CassandraResources_ListCassandraViews" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraViewGetResultResource + CassandraViewGetResultCollection collection = cassandraKeyspace.GetCassandraViewGetResults(); + + // invoke the operation and iterate over the result + await foreach (CassandraViewGetResultResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCassandraViewGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraViewGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraViewGetResultResource + CassandraViewGetResultCollection collection = cassandraKeyspace.GetCassandraViewGetResults(); + + // invoke the operation + string viewName = "viewname"; + CassandraViewGetResultResource result = await collection.GetAsync(viewName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBCassandraViewGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraViewGetResultResource + CassandraViewGetResultCollection collection = cassandraKeyspace.GetCassandraViewGetResults(); + + // invoke the operation + string viewName = "viewname"; + bool result = await collection.ExistsAsync(viewName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBCassandraViewGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBCassandraViewGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraViewGetResultResource + CassandraViewGetResultCollection collection = cassandraKeyspace.GetCassandraViewGetResults(); + + // invoke the operation + string viewName = "viewname"; + NullableResponse response = await collection.GetIfExistsAsync(viewName); + CassandraViewGetResultResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBCassandraViewCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraViewCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraViewGetResultResource + CassandraViewGetResultCollection collection = cassandraKeyspace.GetCassandraViewGetResults(); + + // invoke the operation + string viewName = "viewname"; + CassandraViewGetResultCreateOrUpdateContent content = new CassandraViewGetResultCreateOrUpdateContent(new AzureLocation("placeholder"), new CassandraViewResource("viewname", "SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND columnc IS NOT NULL PRIMARY (columnc, columna)")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, viewName, content); + CassandraViewGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultResource.cs new file mode 100644 index 0000000000000..6224c277baa90 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultResource.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraViewGetResultResource + { + // CosmosDBCassandraViewGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraViewGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewGetResultResource created on azure + // for more information of creating CassandraViewGetResultResource, please refer to the document of CassandraViewGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewGetResultResourceId = CassandraViewGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewGetResultResource cassandraViewGetResult = client.GetCassandraViewGetResultResource(cassandraViewGetResultResourceId); + + // invoke the operation + CassandraViewGetResultResource result = await cassandraViewGetResult.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBCassandraViewCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewGetResultResource created on azure + // for more information of creating CassandraViewGetResultResource, please refer to the document of CassandraViewGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewGetResultResourceId = CassandraViewGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewGetResultResource cassandraViewGetResult = client.GetCassandraViewGetResultResource(cassandraViewGetResultResourceId); + + // invoke the operation + CassandraViewGetResultCreateOrUpdateContent content = new CassandraViewGetResultCreateOrUpdateContent(new AzureLocation("placeholder"), new CassandraViewResource("viewname", "SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND columnc IS NOT NULL PRIMARY (columnc, columna)")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cassandraViewGetResult.UpdateAsync(WaitUntil.Completed, content); + CassandraViewGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBCassandraViewDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewDelete.json + // this example is just showing the usage of "CassandraResources_DeleteCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewGetResultResource created on azure + // for more information of creating CassandraViewGetResultResource, please refer to the document of CassandraViewGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewGetResultResourceId = CassandraViewGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewGetResultResource cassandraViewGetResult = client.GetCassandraViewGetResultResource(cassandraViewGetResultResourceId); + + // invoke the operation + await cassandraViewGetResult.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewThroughputSettingResource.cs new file mode 100644 index 0000000000000..08c3ffb974e2d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewThroughputSettingResource.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraViewThroughputSettingResource + { + // CosmosDBCassandraViewThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraViewThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewThroughputGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraViewThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewThroughputSettingResource created on azure + // for more information of creating CassandraViewThroughputSettingResource, please refer to the document of CassandraViewThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewThroughputSettingResourceId = CassandraViewThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewThroughputSettingResource cassandraViewThroughputSetting = client.GetCassandraViewThroughputSettingResource(cassandraViewThroughputSettingResourceId); + + // invoke the operation + CassandraViewThroughputSettingResource result = await cassandraViewThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraViewThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewThroughputUpdate.json + // this example is just showing the usage of "CassandraResources_UpdateCassandraViewThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewThroughputSettingResource created on azure + // for more information of creating CassandraViewThroughputSettingResource, please refer to the document of CassandraViewThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewThroughputSettingResourceId = CassandraViewThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewThroughputSettingResource cassandraViewThroughputSetting = client.GetCassandraViewThroughputSettingResource(cassandraViewThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("placeholder"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cassandraViewThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CassandraViewThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraViewToAutoscale_CosmosDBCassandraViewMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewMigrateToAutoscale.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraViewToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewThroughputSettingResource created on azure + // for more information of creating CassandraViewThroughputSettingResource, please refer to the document of CassandraViewThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewThroughputSettingResourceId = CassandraViewThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewThroughputSettingResource cassandraViewThroughputSetting = client.GetCassandraViewThroughputSettingResource(cassandraViewThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraViewThroughputSetting.MigrateCassandraViewToAutoscaleAsync(WaitUntil.Completed); + CassandraViewThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraViewToManualThroughput_CosmosDBCassandraViewMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewMigrateToManualThroughput.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraViewToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewThroughputSettingResource created on azure + // for more information of creating CassandraViewThroughputSettingResource, please refer to the document of CassandraViewThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewThroughputSettingResourceId = CassandraViewThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewThroughputSettingResource cassandraViewThroughputSetting = client.GetCassandraViewThroughputSettingResource(cassandraViewThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraViewThroughputSetting.MigrateCassandraViewToManualThroughputAsync(WaitUntil.Completed); + CassandraViewThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountCollection.cs new file mode 100644 index 0000000000000..beccbac8616f5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBAccountCollection + { + // CosmosDBDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGet.json + // this example is just showing the usage of "DatabaseAccounts_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + CosmosDBAccountResource result = await collection.GetAsync(accountName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGet.json + // this example is just showing the usage of "DatabaseAccounts_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + bool result = await collection.ExistsAsync(accountName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGet.json + // this example is just showing the usage of "DatabaseAccounts_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + CosmosDBAccountResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBDatabaseAccountCreateMax + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBDatabaseAccountCreateMax() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountCreateMax.json + // this example is just showing the usage of "DatabaseAccounts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + CosmosDBAccountCreateOrUpdateContent content = new CosmosDBAccountCreateOrUpdateContent(new AzureLocation("westus"), new CosmosDBAccountLocation[] + { +new CosmosDBAccountLocation() +{ +LocationName = new AzureLocation("southcentralus"), +FailoverPriority = 0, +IsZoneRedundant = false, +},new CosmosDBAccountLocation() +{ +LocationName = new AzureLocation("eastus"), +FailoverPriority = 1, +IsZoneRedundant = false, +} + }) + { + Kind = CosmosDBAccountKind.MongoDB, + ConsistencyPolicy = new ConsistencyPolicy(DefaultConsistencyLevel.BoundedStaleness) + { + MaxStalenessPrefix = 200, + MaxIntervalInSeconds = 10, + }, + IPRules = +{ +new CosmosDBIPAddressOrRange() +{ +IPAddressOrRange = "23.43.230.120", +},new CosmosDBIPAddressOrRange() +{ +IPAddressOrRange = "110.12.240.0/12", +} +}, + IsVirtualNetworkFilterEnabled = true, + VirtualNetworkRules = +{ +new CosmosDBVirtualNetworkRule() +{ +Id = new ResourceIdentifier("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), +IgnoreMissingVnetServiceEndpoint = false, +} +}, + KeyVaultKeyUri = new Uri("https://myKeyVault.vault.azure.net"), + DefaultIdentity = "FirstPartyIdentity", + PublicNetworkAccess = CosmosDBPublicNetworkAccess.Enabled, + IsFreeTierEnabled = false, + ApiServerVersion = CosmosDBServerVersion.V3_2, + IsAnalyticalStorageEnabled = true, + AnalyticalStorageSchemaType = AnalyticalStorageSchemaType.WellDefined, + CreateMode = CosmosDBAccountCreateMode.Default, + BackupPolicy = new PeriodicModeBackupPolicy() + { + PeriodicModeProperties = new PeriodicModeProperties() + { + BackupIntervalInMinutes = 240, + BackupRetentionIntervalInHours = 8, + BackupStorageRedundancy = CosmosDBBackupStorageRedundancy.Geo, + }, + }, + Cors = +{ +new CosmosDBAccountCorsPolicy("https://test") +}, + NetworkAclBypass = NetworkAclBypass.AzureServices, + NetworkAclBypassResourceIds = +{ +new ResourceIdentifier("/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName") +}, + CapacityTotalThroughputLimit = 2000, + EnableMaterializedViews = false, + EnableBurstCapacity = true, + MinimalTlsVersion = CosmosDBMinimalTlsVersion.Tls12, + EnablePriorityBasedExecution = true, + DefaultPriorityLevel = DefaultPriorityLevel.Low, + Identity = new ManagedServiceIdentity("SystemAssigned,UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +}, + }, + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, content); + CosmosDBAccountResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDatabaseAccountCreateMin + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBDatabaseAccountCreateMin() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountCreateMin.json + // this example is just showing the usage of "DatabaseAccounts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + CosmosDBAccountCreateOrUpdateContent content = new CosmosDBAccountCreateOrUpdateContent(new AzureLocation("westus"), new CosmosDBAccountLocation[] + { +new CosmosDBAccountLocation() +{ +LocationName = new AzureLocation("southcentralus"), +FailoverPriority = 0, +IsZoneRedundant = false, +} + }) + { + CreateMode = CosmosDBAccountCreateMode.Default, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, content); + CosmosDBAccountResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBRestoreDatabaseAccountCreateUpdate.json + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBRestoreDatabaseAccountCreateUpdateJson() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestoreDatabaseAccountCreateUpdate.json + // this example is just showing the usage of "DatabaseAccounts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + CosmosDBAccountCreateOrUpdateContent content = new CosmosDBAccountCreateOrUpdateContent(new AzureLocation("westus"), new CosmosDBAccountLocation[] + { +new CosmosDBAccountLocation() +{ +LocationName = new AzureLocation("southcentralus"), +FailoverPriority = 0, +IsZoneRedundant = false, +} + }) + { + Kind = CosmosDBAccountKind.GlobalDocumentDB, + ConsistencyPolicy = new ConsistencyPolicy(DefaultConsistencyLevel.BoundedStaleness) + { + MaxStalenessPrefix = 200, + MaxIntervalInSeconds = 10, + }, + KeyVaultKeyUri = new Uri("https://myKeyVault.vault.azure.net"), + IsFreeTierEnabled = false, + ApiServerVersion = CosmosDBServerVersion.V3_2, + IsAnalyticalStorageEnabled = true, + CreateMode = CosmosDBAccountCreateMode.Restore, + BackupPolicy = new ContinuousModeBackupPolicy() + { + ContinuousModeTier = ContinuousTier.Continuous30Days, + }, + RestoreParameters = new CosmosDBAccountRestoreParameters() + { + RestoreMode = CosmosDBAccountRestoreMode.PointInTime, + DatabasesToRestore = +{ +new DatabaseRestoreResourceInfo() +{ +DatabaseName = "db1", +CollectionNames = +{ +"collection1","collection2" +}, +},new DatabaseRestoreResourceInfo() +{ +DatabaseName = "db2", +CollectionNames = +{ +"collection3","collection4" +}, +} +}, + SourceBackupLocation = "westus", + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc", + RestoreTimestampInUtc = DateTimeOffset.Parse("2021-03-11T22:05:09Z"), + }, + EnableMaterializedViews = false, + MinimalTlsVersion = CosmosDBMinimalTlsVersion.Tls, + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, content); + CosmosDBAccountResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDatabaseAccountListByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBDatabaseAccountListByResourceGroup() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountListByResourceGroup.json + // this example is just showing the usage of "DatabaseAccounts_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBAccountResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountResource.cs new file mode 100644 index 0000000000000..9f9625ce6e8b6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountResource.cs @@ -0,0 +1,1086 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBAccountResource + { + // CosmosDBDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGet.json + // this example is just showing the usage of "DatabaseAccounts_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBAccountResource result = await cosmosDBAccount.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDatabaseAccountPatch + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBDatabaseAccountPatch() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountPatch.json + // this example is just showing the usage of "DatabaseAccounts_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBAccountPatch patch = new CosmosDBAccountPatch() + { + Tags = +{ +["dept"] = "finance", +}, + Location = new AzureLocation("westus"), + Identity = new ManagedServiceIdentity("SystemAssigned,UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +}, + }, + ConsistencyPolicy = new ConsistencyPolicy(DefaultConsistencyLevel.BoundedStaleness) + { + MaxStalenessPrefix = 200, + MaxIntervalInSeconds = 10, + }, + IPRules = +{ +new CosmosDBIPAddressOrRange() +{ +IPAddressOrRange = "23.43.230.120", +},new CosmosDBIPAddressOrRange() +{ +IPAddressOrRange = "110.12.240.0/12", +} +}, + IsVirtualNetworkFilterEnabled = true, + VirtualNetworkRules = +{ +new CosmosDBVirtualNetworkRule() +{ +Id = new ResourceIdentifier("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), +IgnoreMissingVnetServiceEndpoint = false, +} +}, + DefaultIdentity = "FirstPartyIdentity", + IsFreeTierEnabled = false, + IsAnalyticalStorageEnabled = true, + AnalyticalStorageSchemaType = AnalyticalStorageSchemaType.WellDefined, + BackupPolicy = new PeriodicModeBackupPolicy() + { + PeriodicModeProperties = new PeriodicModeProperties() + { + BackupIntervalInMinutes = 240, + BackupRetentionIntervalInHours = 720, + BackupStorageRedundancy = CosmosDBBackupStorageRedundancy.Geo, + }, + }, + NetworkAclBypass = NetworkAclBypass.AzureServices, + NetworkAclBypassResourceIds = +{ +new ResourceIdentifier("/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName") +}, + DiagnosticLogEnableFullTextQuery = EnableFullTextQuery.True, + CapacityTotalThroughputLimit = 2000, + EnablePartitionMerge = true, + EnableBurstCapacity = true, + MinimalTlsVersion = CosmosDBMinimalTlsVersion.Tls, + EnablePriorityBasedExecution = true, + DefaultPriorityLevel = DefaultPriorityLevel.Low, + }; + ArmOperation lro = await cosmosDBAccount.UpdateAsync(WaitUntil.Completed, patch); + CosmosDBAccountResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDatabaseAccountDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBDatabaseAccountDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountDelete.json + // this example is just showing the usage of "DatabaseAccounts_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + await cosmosDBAccount.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountFailoverPriorityChange + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task FailoverPriorityChange_CosmosDBDatabaseAccountFailoverPriorityChange() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountFailoverPriorityChange.json + // this example is just showing the usage of "DatabaseAccounts_FailoverPriorityChange" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1-failover"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBFailoverPolicies failoverParameters = new CosmosDBFailoverPolicies(new CosmosDBFailoverPolicy[] + { +new CosmosDBFailoverPolicy() +{ +LocationName = new AzureLocation("eastus"), +FailoverPriority = 0, +},new CosmosDBFailoverPolicy() +{ +LocationName = new AzureLocation("westus"), +FailoverPriority = 1, +} + }); + await cosmosDBAccount.FailoverPriorityChangeAsync(WaitUntil.Completed, failoverParameters); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetCosmosDBAccounts_CosmosDBDatabaseAccountList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountList.json + // this example is just showing the usage of "DatabaseAccounts_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (CosmosDBAccountResource item in subscriptionResource.GetCosmosDBAccountsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountListKeys + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetKeys_CosmosDBDatabaseAccountListKeys() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountListKeys.json + // this example is just showing the usage of "DatabaseAccounts_ListKeys" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBAccountKeyList result = await cosmosDBAccount.GetKeysAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBDatabaseAccountListConnectionStrings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetConnectionStrings_CosmosDBDatabaseAccountListConnectionStrings() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountListConnectionStrings.json + // this example is just showing the usage of "DatabaseAccounts_ListConnectionStrings" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (CosmosDBAccountConnectionString item in cosmosDBAccount.GetConnectionStringsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountListConnectionStringsMongo + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetConnectionStrings_CosmosDBDatabaseAccountListConnectionStringsMongo() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json + // this example is just showing the usage of "DatabaseAccounts_ListConnectionStrings" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "mongo-ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (CosmosDBAccountConnectionString item in cosmosDBAccount.GetConnectionStringsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountOfflineRegion + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task OfflineRegion_CosmosDBDatabaseAccountOfflineRegion() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountOfflineRegion.json + // this example is just showing the usage of "DatabaseAccounts_OfflineRegion" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + RegionForOnlineOffline regionParameterForOffline = new RegionForOnlineOffline("North Europe"); + await cosmosDBAccount.OfflineRegionAsync(WaitUntil.Completed, regionParameterForOffline); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountOnlineRegion + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task OnlineRegion_CosmosDBDatabaseAccountOnlineRegion() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountOnlineRegion.json + // this example is just showing the usage of "DatabaseAccounts_OnlineRegion" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + RegionForOnlineOffline regionParameterForOnline = new RegionForOnlineOffline("North Europe"); + await cosmosDBAccount.OnlineRegionAsync(WaitUntil.Completed, regionParameterForOnline); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountListReadOnlyKeys + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetReadOnlyKeys_CosmosDBDatabaseAccountListReadOnlyKeys() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json + // this example is just showing the usage of "DatabaseAccounts_ListReadOnlyKeys" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBAccountReadOnlyKeyList result = await cosmosDBAccount.GetReadOnlyKeysAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBDatabaseAccountRegenerateKey + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RegenerateKey_CosmosDBDatabaseAccountRegenerateKey() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountRegenerateKey.json + // this example is just showing the usage of "DatabaseAccounts_RegenerateKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBAccountRegenerateKeyContent content = new CosmosDBAccountRegenerateKeyContent(CosmosDBAccountKeyKind.Primary); + await cosmosDBAccount.RegenerateKeyAsync(WaitUntil.Completed, content); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountCheckNameExists + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckNameExistsDatabaseAccount_CosmosDBDatabaseAccountCheckNameExists() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountCheckNameExists.json + // this example is just showing the usage of "DatabaseAccounts_CheckNameExists" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation + string accountName = "ddb1"; + bool result = await tenantResource.CheckNameExistsDatabaseAccountAsync(accountName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBDatabaseAccountGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetrics_CosmosDBDatabaseAccountGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGetMetrics.json + // this example is just showing the usage of "DatabaseAccounts_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string filter = "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBBaseMetric item in cosmosDBAccount.GetMetricsAsync(filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountGetUsages + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetUsages_CosmosDBDatabaseAccountGetUsages() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGetUsages.json + // this example is just showing the usage of "DatabaseAccounts_ListUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string filter = "$filter=name.value eq 'Storage'"; + await foreach (CosmosDBBaseUsage item in cosmosDBAccount.GetUsagesAsync(filter: filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountGetMetricDefinitions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricDefinitions_CosmosDBDatabaseAccountGetMetricDefinitions() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGetMetricDefinitions.json + // this example is just showing the usage of "DatabaseAccounts_ListMetricDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (CosmosDBMetricDefinition item in cosmosDBAccount.GetMetricDefinitionsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsDatabases_CosmosDBDatabaseGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseGetMetrics.json + // this example is just showing the usage of "Database_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "rid"; + string filter = "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBBaseMetric item in cosmosDBAccount.GetMetricsDatabasesAsync(databaseRid, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseGetUsages + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetUsagesDatabases_CosmosDBDatabaseGetUsages() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseGetUsages.json + // this example is just showing the usage of "Database_ListUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string filter = "$filter=name.value eq 'Storage'"; + await foreach (CosmosDBBaseUsage item in cosmosDBAccount.GetUsagesDatabasesAsync(databaseRid, filter: filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseGetMetricDefinitions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricDefinitionsDatabases_CosmosDBDatabaseGetMetricDefinitions() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseGetMetricDefinitions.json + // this example is just showing the usage of "Database_ListMetricDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + await foreach (CosmosDBMetricDefinition item in cosmosDBAccount.GetMetricDefinitionsDatabasesAsync(databaseRid)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCollectionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsCollections_CosmosDBCollectionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionGetMetrics.json + // this example is just showing the usage of "Collection_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBBaseMetric item in cosmosDBAccount.GetMetricsCollectionsAsync(databaseRid, collectionRid, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCollectionGetUsages + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetUsagesCollections_CosmosDBCollectionGetUsages() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionGetUsages.json + // this example is just showing the usage of "Collection_ListUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=name.value eq 'Storage'"; + await foreach (CosmosDBBaseUsage item in cosmosDBAccount.GetUsagesCollectionsAsync(databaseRid, collectionRid, filter: filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCollectionGetMetricDefinitions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricDefinitionsCollections_CosmosDBCollectionGetMetricDefinitions() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionGetMetricDefinitions.json + // this example is just showing the usage of "Collection_ListMetricDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + await foreach (CosmosDBMetricDefinition item in cosmosDBAccount.GetMetricDefinitionsCollectionsAsync(databaseRid, collectionRid)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRegionCollectionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsCollectionRegions_CosmosDBRegionCollectionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRegionCollectionGetMetrics.json + // this example is just showing the usage of "CollectionRegion_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string region = "North Europe"; + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBBaseMetric item in cosmosDBAccount.GetMetricsCollectionRegionsAsync(region, databaseRid, collectionRid, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsDatabaseAccountRegions_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountRegionGetMetrics.json + // this example is just showing the usage of "DatabaseAccountRegion_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string region = "North Europe"; + string filter = "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBBaseMetric item in cosmosDBAccount.GetMetricsDatabaseAccountRegionsAsync(region, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsPercentileSourceTargets_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPercentileSourceTargetGetMetrics.json + // this example is just showing the usage of "PercentileSourceTarget_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string sourceRegion = "West Central US"; + string targetRegion = "East US"; + string filter = "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBPercentileMetric item in cosmosDBAccount.GetMetricsPercentileSourceTargetsAsync(sourceRegion, targetRegion, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsPercentileTargets_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPercentileTargetGetMetrics.json + // this example is just showing the usage of "PercentileTarget_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string targetRegion = "East US"; + string filter = "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBPercentileMetric item in cosmosDBAccount.GetMetricsPercentileTargetsAsync(targetRegion, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsPercentiles_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPercentileGetMetrics.json + // this example is just showing the usage of "Percentile_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string filter = "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBPercentileMetric item in cosmosDBAccount.GetMetricsPercentilesAsync(filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsCollectionPartitionRegions_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionPartitionRegionGetMetrics.json + // this example is just showing the usage of "CollectionPartitionRegion_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string region = "North Europe"; + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z"; + await foreach (PartitionMetric item in cosmosDBAccount.GetMetricsCollectionPartitionRegionsAsync(region, databaseRid, collectionRid, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsCollectionPartitions_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionPartitionGetMetrics.json + // this example is just showing the usage of "CollectionPartition_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z"; + await foreach (PartitionMetric item in cosmosDBAccount.GetMetricsCollectionPartitionsAsync(databaseRid, collectionRid, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCollectionGetUsages + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetUsagesCollectionPartitions_CosmosDBCollectionGetUsages() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionPartitionGetUsages.json + // this example is just showing the usage of "CollectionPartition_ListUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=name.value eq 'Partition Storage'"; + await foreach (PartitionUsage item in cosmosDBAccount.GetUsagesCollectionPartitionsAsync(databaseRid, collectionRid, filter: filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsPartitionKeyRangeIds_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPKeyRangeIdGetMetrics.json + // this example is just showing the usage of "PartitionKeyRangeId_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string partitionKeyRangeId = "0"; + string filter = "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z"; + await foreach (PartitionMetric item in cosmosDBAccount.GetMetricsPartitionKeyRangeIdsAsync(databaseRid, collectionRid, partitionKeyRangeId, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsPartitionKeyRangeIdRegions_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPKeyRangeIdRegionGetMetrics.json + // this example is just showing the usage of "PartitionKeyRangeIdRegion_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string region = "West US"; + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string partitionKeyRangeId = "0"; + string filter = "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z"; + await foreach (PartitionMetric item in cosmosDBAccount.GetMetricsPartitionKeyRangeIdRegionsAsync(region, databaseRid, collectionRid, partitionKeyRangeId, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleCollection.cs new file mode 100644 index 0000000000000..f21fa72c1c5e1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleCollection.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBFirewallRuleCollection + { + // Create a firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateAFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleCreate.json + // this example is just showing the usage of "MongoClusters_CreateOrUpdateFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this CosmosDBFirewallRuleResource + CosmosDBFirewallRuleCollection collection = mongoCluster.GetCosmosDBFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + CosmosDBFirewallRuleData data = new CosmosDBFirewallRuleData("0.0.0.0", "255.255.255.255"); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, firewallRuleName, data); + CosmosDBFirewallRuleResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get the firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetTheFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleGet.json + // this example is just showing the usage of "MongoClusters_GetFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this CosmosDBFirewallRuleResource + CosmosDBFirewallRuleCollection collection = mongoCluster.GetCosmosDBFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + CosmosDBFirewallRuleResource result = await collection.GetAsync(firewallRuleName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get the firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetTheFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleGet.json + // this example is just showing the usage of "MongoClusters_GetFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this CosmosDBFirewallRuleResource + CosmosDBFirewallRuleCollection collection = mongoCluster.GetCosmosDBFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + bool result = await collection.ExistsAsync(firewallRuleName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get the firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleGet.json + // this example is just showing the usage of "MongoClusters_GetFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this CosmosDBFirewallRuleResource + CosmosDBFirewallRuleCollection collection = mongoCluster.GetCosmosDBFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(firewallRuleName); + CosmosDBFirewallRuleResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // List firewall rules of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListFirewallRulesOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleList.json + // this example is just showing the usage of "MongoClusters_ListFirewallRules" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this CosmosDBFirewallRuleResource + CosmosDBFirewallRuleCollection collection = mongoCluster.GetCosmosDBFirewallRules(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBFirewallRuleResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleResource.cs new file mode 100644 index 0000000000000..a09baa2bf96d7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleResource.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBFirewallRuleResource + { + // Create a firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateAFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleCreate.json + // this example is just showing the usage of "MongoClusters_CreateOrUpdateFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBFirewallRuleResource created on azure + // for more information of creating CosmosDBFirewallRuleResource, please refer to the document of CosmosDBFirewallRuleResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + string firewallRuleName = "rule1"; + ResourceIdentifier cosmosDBFirewallRuleResourceId = CosmosDBFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName, firewallRuleName); + CosmosDBFirewallRuleResource cosmosDBFirewallRule = client.GetCosmosDBFirewallRuleResource(cosmosDBFirewallRuleResourceId); + + // invoke the operation + CosmosDBFirewallRuleData data = new CosmosDBFirewallRuleData("0.0.0.0", "255.255.255.255"); + ArmOperation lro = await cosmosDBFirewallRule.UpdateAsync(WaitUntil.Completed, data); + CosmosDBFirewallRuleResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete the firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteTheFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleDelete.json + // this example is just showing the usage of "MongoClusters_DeleteFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBFirewallRuleResource created on azure + // for more information of creating CosmosDBFirewallRuleResource, please refer to the document of CosmosDBFirewallRuleResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + string firewallRuleName = "rule1"; + ResourceIdentifier cosmosDBFirewallRuleResourceId = CosmosDBFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName, firewallRuleName); + CosmosDBFirewallRuleResource cosmosDBFirewallRule = client.GetCosmosDBFirewallRuleResource(cosmosDBFirewallRuleResourceId); + + // invoke the operation + await cosmosDBFirewallRule.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get the firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetTheFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleGet.json + // this example is just showing the usage of "MongoClusters_GetFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBFirewallRuleResource created on azure + // for more information of creating CosmosDBFirewallRuleResource, please refer to the document of CosmosDBFirewallRuleResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + string firewallRuleName = "rule1"; + ResourceIdentifier cosmosDBFirewallRuleResourceId = CosmosDBFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName, firewallRuleName); + CosmosDBFirewallRuleResource cosmosDBFirewallRule = client.GetCosmosDBFirewallRuleResource(cosmosDBFirewallRuleResourceId); + + // invoke the operation + CosmosDBFirewallRuleResource result = await cosmosDBFirewallRule.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationCollection.cs new file mode 100644 index 0000000000000..4e89317e31329 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationCollection.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBLocationCollection + { + // CosmosDBLocationList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBLocationList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBLocationList.json + // this example is just showing the usage of "Locations_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CosmosDBLocationResource + CosmosDBLocationCollection collection = subscriptionResource.GetCosmosDBLocations(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBLocationResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBLocationData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBLocationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBLocationGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBLocationGet.json + // this example is just showing the usage of "Locations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CosmosDBLocationResource + CosmosDBLocationCollection collection = subscriptionResource.GetCosmosDBLocations(); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + CosmosDBLocationResource result = await collection.GetAsync(location); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBLocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBLocationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBLocationGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBLocationGet.json + // this example is just showing the usage of "Locations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CosmosDBLocationResource + CosmosDBLocationCollection collection = subscriptionResource.GetCosmosDBLocations(); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + bool result = await collection.ExistsAsync(location); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBLocationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBLocationGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBLocationGet.json + // this example is just showing the usage of "Locations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CosmosDBLocationResource + CosmosDBLocationCollection collection = subscriptionResource.GetCosmosDBLocations(); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + NullableResponse response = await collection.GetIfExistsAsync(location); + CosmosDBLocationResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBLocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationResource.cs new file mode 100644 index 0000000000000..eceb23a4ff237 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationResource.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBLocationResource + { + // CosmosDBLocationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBLocationGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBLocationGet.json + // this example is just showing the usage of "Locations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + AzureLocation location = new AzureLocation("westus"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // invoke the operation + CosmosDBLocationResource result = await cosmosDBLocation.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBLocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Check name availability + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckMongoClusterNameAailability_CheckNameAvailability() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterNameAvailability.json + // this example is just showing the usage of "MongoClusters_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + AzureLocation location = new AzureLocation("westus2"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // invoke the operation + CheckCosmosDBNameAvailabilityContent content = new CheckCosmosDBNameAvailabilityContent() + { + Name = "newmongocluster", + ResourceType = "Microsoft.DocumentDB/mongoClusters", + }; + CheckCosmosDBNameAvailabilityResponse result = await cosmosDBLocation.CheckMongoClusterNameAailabilityAsync(content); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Check name availability already exists result + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckMongoClusterNameAailability_CheckNameAvailabilityAlreadyExistsResult() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterNameAvailability_AlreadyExists.json + // this example is just showing the usage of "MongoClusters_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + AzureLocation location = new AzureLocation("westus2"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // invoke the operation + CheckCosmosDBNameAvailabilityContent content = new CheckCosmosDBNameAvailabilityContent() + { + Name = "existingmongocluster", + ResourceType = "Microsoft.DocumentDB/mongoClusters", + }; + CheckCosmosDBNameAvailabilityResponse result = await cosmosDBLocation.CheckMongoClusterNameAailabilityAsync(content); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionCollection.cs new file mode 100644 index 0000000000000..fa540c5c80cd1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBPrivateEndpointConnectionCollection + { + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionListGet.json + // this example is just showing the usage of "PrivateEndpointConnections_ListByDatabaseAccount" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateEndpointConnectionResource + CosmosDBPrivateEndpointConnectionCollection collection = cosmosDBAccount.GetCosmosDBPrivateEndpointConnections(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBPrivateEndpointConnectionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateEndpointConnectionResource + CosmosDBPrivateEndpointConnectionCollection collection = cosmosDBAccount.GetCosmosDBPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + CosmosDBPrivateEndpointConnectionResource result = await collection.GetAsync(privateEndpointConnectionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateEndpointConnectionResource + CosmosDBPrivateEndpointConnectionCollection collection = cosmosDBAccount.GetCosmosDBPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + bool result = await collection.ExistsAsync(privateEndpointConnectionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateEndpointConnectionResource + CosmosDBPrivateEndpointConnectionCollection collection = cosmosDBAccount.GetCosmosDBPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + CosmosDBPrivateEndpointConnectionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Approve or reject a private endpoint connection with a given name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApproveOrRejectAPrivateEndpointConnectionWithAGivenName() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionUpdate.json + // this example is just showing the usage of "PrivateEndpointConnections_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateEndpointConnectionResource + CosmosDBPrivateEndpointConnectionCollection collection = cosmosDBAccount.GetCosmosDBPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + CosmosDBPrivateEndpointConnectionData data = new CosmosDBPrivateEndpointConnectionData() + { + ConnectionState = new CosmosDBPrivateLinkServiceConnectionStateProperty() + { + Status = "Approved", + Description = "Approved by johndoe@contoso.com", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); + CosmosDBPrivateEndpointConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionResource.cs new file mode 100644 index 0000000000000..abc0c41eabaa6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionResource.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBPrivateEndpointConnectionResource + { + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBPrivateEndpointConnectionResource created on azure + // for more information of creating CosmosDBPrivateEndpointConnectionResource, please refer to the document of CosmosDBPrivateEndpointConnectionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string privateEndpointConnectionName = "privateEndpointConnectionName"; + ResourceIdentifier cosmosDBPrivateEndpointConnectionResourceId = CosmosDBPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, privateEndpointConnectionName); + CosmosDBPrivateEndpointConnectionResource cosmosDBPrivateEndpointConnection = client.GetCosmosDBPrivateEndpointConnectionResource(cosmosDBPrivateEndpointConnectionResourceId); + + // invoke the operation + CosmosDBPrivateEndpointConnectionResource result = await cosmosDBPrivateEndpointConnection.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Approve or reject a private endpoint connection with a given name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApproveOrRejectAPrivateEndpointConnectionWithAGivenName() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionUpdate.json + // this example is just showing the usage of "PrivateEndpointConnections_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBPrivateEndpointConnectionResource created on azure + // for more information of creating CosmosDBPrivateEndpointConnectionResource, please refer to the document of CosmosDBPrivateEndpointConnectionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string privateEndpointConnectionName = "privateEndpointConnectionName"; + ResourceIdentifier cosmosDBPrivateEndpointConnectionResourceId = CosmosDBPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, privateEndpointConnectionName); + CosmosDBPrivateEndpointConnectionResource cosmosDBPrivateEndpointConnection = client.GetCosmosDBPrivateEndpointConnectionResource(cosmosDBPrivateEndpointConnectionResourceId); + + // invoke the operation + CosmosDBPrivateEndpointConnectionData data = new CosmosDBPrivateEndpointConnectionData() + { + ConnectionState = new CosmosDBPrivateLinkServiceConnectionStateProperty() + { + Status = "Approved", + Description = "Approved by johndoe@contoso.com", + }, + }; + ArmOperation lro = await cosmosDBPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); + CosmosDBPrivateEndpointConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Deletes a private endpoint connection with a given name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeletesAPrivateEndpointConnectionWithAGivenName() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionDelete.json + // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBPrivateEndpointConnectionResource created on azure + // for more information of creating CosmosDBPrivateEndpointConnectionResource, please refer to the document of CosmosDBPrivateEndpointConnectionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string privateEndpointConnectionName = "privateEndpointConnectionName"; + ResourceIdentifier cosmosDBPrivateEndpointConnectionResourceId = CosmosDBPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, privateEndpointConnectionName); + CosmosDBPrivateEndpointConnectionResource cosmosDBPrivateEndpointConnection = client.GetCosmosDBPrivateEndpointConnectionResource(cosmosDBPrivateEndpointConnectionResourceId); + + // invoke the operation + await cosmosDBPrivateEndpointConnection.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResource.cs new file mode 100644 index 0000000000000..5ab289ca9532a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBPrivateLinkResource + { + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBPrivateLinkResource created on azure + // for more information of creating CosmosDBPrivateLinkResource, please refer to the document of CosmosDBPrivateLinkResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string groupName = "sql"; + ResourceIdentifier cosmosDBPrivateLinkResourceId = CosmosDBPrivateLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, groupName); + CosmosDBPrivateLinkResource cosmosDBPrivateLinkResource = client.GetCosmosDBPrivateLinkResource(cosmosDBPrivateLinkResourceId); + + // invoke the operation + CosmosDBPrivateLinkResource result = await cosmosDBPrivateLinkResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResourceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResourceCollection.cs new file mode 100644 index 0000000000000..19e31ec43400c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResourceCollection.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBPrivateLinkResourceCollection + { + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateLinkResourceListGet.json + // this example is just showing the usage of "PrivateLinkResources_ListByDatabaseAccount" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateLinkResource + CosmosDBPrivateLinkResourceCollection collection = cosmosDBAccount.GetCosmosDBPrivateLinkResources(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBPrivateLinkResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateLinkResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateLinkResource + CosmosDBPrivateLinkResourceCollection collection = cosmosDBAccount.GetCosmosDBPrivateLinkResources(); + + // invoke the operation + string groupName = "sql"; + CosmosDBPrivateLinkResource result = await collection.GetAsync(groupName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateLinkResource + CosmosDBPrivateLinkResourceCollection collection = cosmosDBAccount.GetCosmosDBPrivateLinkResources(); + + // invoke the operation + string groupName = "sql"; + bool result = await collection.ExistsAsync(groupName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateLinkResource + CosmosDBPrivateLinkResourceCollection collection = cosmosDBAccount.GetCosmosDBPrivateLinkResources(); + + // invoke the operation + string groupName = "sql"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + CosmosDBPrivateLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceCollection.cs new file mode 100644 index 0000000000000..d78a9cefed309 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceCollection.cs @@ -0,0 +1,662 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBServiceCollection + { + // CosmosDBServicesList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBServicesList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBServicesList.json + // this example is just showing the usage of "Service_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBServiceResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // DataTransferServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_DataTransferServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "DataTransfer"; + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.DataTransfer, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GraphAPIComputeServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_GraphAPIComputeServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "GraphAPICompute"; + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.GraphApiCompute, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // MaterializedViewsBuilderServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_MaterializedViewsBuilderServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "MaterializedViewsBuilder"; + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.MaterializedViewsBuilder, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SqlDedicatedGatewayServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_SqlDedicatedGatewayServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "SqlDedicatedGateway"; + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.SqlDedicatedGateway, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DataTransferServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_DataTransferServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "DataTransfer"; + CosmosDBServiceResource result = await collection.GetAsync(serviceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DataTransferServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_DataTransferServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "DataTransfer"; + bool result = await collection.ExistsAsync(serviceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // DataTransferServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DataTransferServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "DataTransfer"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + CosmosDBServiceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // GraphAPIComputeServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GraphAPIComputeServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "GraphAPICompute"; + CosmosDBServiceResource result = await collection.GetAsync(serviceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GraphAPIComputeServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GraphAPIComputeServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "GraphAPICompute"; + bool result = await collection.ExistsAsync(serviceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GraphAPIComputeServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GraphAPIComputeServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "GraphAPICompute"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + CosmosDBServiceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // MaterializedViewsBuilderServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_MaterializedViewsBuilderServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "MaterializedViewsBuilder"; + CosmosDBServiceResource result = await collection.GetAsync(serviceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // MaterializedViewsBuilderServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_MaterializedViewsBuilderServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "MaterializedViewsBuilder"; + bool result = await collection.ExistsAsync(serviceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // MaterializedViewsBuilderServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MaterializedViewsBuilderServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "MaterializedViewsBuilder"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + CosmosDBServiceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // SqlDedicatedGatewayServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SqlDedicatedGatewayServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "SqlDedicatedGateway"; + CosmosDBServiceResource result = await collection.GetAsync(serviceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SqlDedicatedGatewayServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_SqlDedicatedGatewayServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "SqlDedicatedGateway"; + bool result = await collection.ExistsAsync(serviceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // SqlDedicatedGatewayServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SqlDedicatedGatewayServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "SqlDedicatedGateway"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + CosmosDBServiceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceResource.cs new file mode 100644 index 0000000000000..ce661b72b8247 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceResource.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBServiceResource + { + // DataTransferServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_DataTransferServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "DataTransfer"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.DataTransfer, + }; + ArmOperation lro = await cosmosDBService.UpdateAsync(WaitUntil.Completed, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GraphAPIComputeServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_GraphAPIComputeServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "GraphAPICompute"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.GraphApiCompute, + }; + ArmOperation lro = await cosmosDBService.UpdateAsync(WaitUntil.Completed, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // MaterializedViewsBuilderServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_MaterializedViewsBuilderServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "MaterializedViewsBuilder"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.MaterializedViewsBuilder, + }; + ArmOperation lro = await cosmosDBService.UpdateAsync(WaitUntil.Completed, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SqlDedicatedGatewayServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_SqlDedicatedGatewayServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "SqlDedicatedGateway"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.SqlDedicatedGateway, + }; + ArmOperation lro = await cosmosDBService.UpdateAsync(WaitUntil.Completed, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DataTransferServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_DataTransferServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "DataTransfer"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceResource result = await cosmosDBService.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GraphAPIComputeServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GraphAPIComputeServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "GraphAPICompute"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceResource result = await cosmosDBService.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // MaterializedViewsBuilderServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_MaterializedViewsBuilderServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "MaterializedViewsBuilder"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceResource result = await cosmosDBService.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SqlDedicatedGatewayServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SqlDedicatedGatewayServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "SqlDedicatedGateway"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceResource result = await cosmosDBService.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DataTransferServiceDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DataTransferServiceDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceDelete.json + // this example is just showing the usage of "Service_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "DataTransfer"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + await cosmosDBService.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // GraphAPIComputeServiceDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_GraphAPIComputeServiceDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceDelete.json + // this example is just showing the usage of "Service_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "GraphAPICompute"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + await cosmosDBService.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // MaterializedViewsBuilderServiceDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_MaterializedViewsBuilderServiceDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceDelete.json + // this example is just showing the usage of "Service_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "MaterializedViewsBuilder"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + await cosmosDBService.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // SqlDedicatedGatewayServiceDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_SqlDedicatedGatewayServiceDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceDelete.json + // this example is just showing the usage of "Service_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "SqlDedicatedGateway"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + await cosmosDBService.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyCollection.cs new file mode 100644 index 0000000000000..90a72ef2de574 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyCollection.cs @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlClientEncryptionKeyCollection + { + // CosmosDBClientEncryptionKeysList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBClientEncryptionKeysList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeysList.json + // this example is just showing the usage of "SqlResources_ListClientEncryptionKeys" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlClientEncryptionKeyResource + CosmosDBSqlClientEncryptionKeyCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlClientEncryptionKeys(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlClientEncryptionKeyResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBClientEncryptionKeyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBClientEncryptionKeyGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json + // this example is just showing the usage of "SqlResources_GetClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlClientEncryptionKeyResource + CosmosDBSqlClientEncryptionKeyCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlClientEncryptionKeys(); + + // invoke the operation + string clientEncryptionKeyName = "cekName"; + CosmosDBSqlClientEncryptionKeyResource result = await collection.GetAsync(clientEncryptionKeyName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBClientEncryptionKeyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBClientEncryptionKeyGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json + // this example is just showing the usage of "SqlResources_GetClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlClientEncryptionKeyResource + CosmosDBSqlClientEncryptionKeyCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlClientEncryptionKeys(); + + // invoke the operation + string clientEncryptionKeyName = "cekName"; + bool result = await collection.ExistsAsync(clientEncryptionKeyName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBClientEncryptionKeyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBClientEncryptionKeyGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json + // this example is just showing the usage of "SqlResources_GetClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlClientEncryptionKeyResource + CosmosDBSqlClientEncryptionKeyCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlClientEncryptionKeys(); + + // invoke the operation + string clientEncryptionKeyName = "cekName"; + NullableResponse response = await collection.GetIfExistsAsync(clientEncryptionKeyName); + CosmosDBSqlClientEncryptionKeyResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBClientEncryptionKeyCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBClientEncryptionKeyCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlClientEncryptionKeyResource + CosmosDBSqlClientEncryptionKeyCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlClientEncryptionKeys(); + + // invoke the operation + string clientEncryptionKeyName = "cekName"; + CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent content = new CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(new CosmosDBSqlClientEncryptionKeyResourceInfo() + { + Id = "cekName", + EncryptionAlgorithm = "AEAD_AES_256_CBC_HMAC_SHA256", + WrappedDataEncryptionKey = Convert.FromBase64String("VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU="), + KeyWrapMetadata = new CosmosDBKeyWrapMetadata() + { + Name = "customerManagedKey", + CosmosDBKeyWrapMetadataType = "AzureKeyVault", + Value = "AzureKeyVault Key URL", + Algorithm = "RSA-OAEP", + }, + }); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clientEncryptionKeyName, content); + CosmosDBSqlClientEncryptionKeyResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyResource.cs new file mode 100644 index 0000000000000..a7db2ffeaab9d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyResource.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlClientEncryptionKeyResource + { + // CosmosDBClientEncryptionKeyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBClientEncryptionKeyGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json + // this example is just showing the usage of "SqlResources_GetClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlClientEncryptionKeyResource created on azure + // for more information of creating CosmosDBSqlClientEncryptionKeyResource, please refer to the document of CosmosDBSqlClientEncryptionKeyResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + string clientEncryptionKeyName = "cekName"; + ResourceIdentifier cosmosDBSqlClientEncryptionKeyResourceId = CosmosDBSqlClientEncryptionKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, clientEncryptionKeyName); + CosmosDBSqlClientEncryptionKeyResource cosmosDBSqlClientEncryptionKey = client.GetCosmosDBSqlClientEncryptionKeyResource(cosmosDBSqlClientEncryptionKeyResourceId); + + // invoke the operation + CosmosDBSqlClientEncryptionKeyResource result = await cosmosDBSqlClientEncryptionKey.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBClientEncryptionKeyCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBClientEncryptionKeyCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlClientEncryptionKeyResource created on azure + // for more information of creating CosmosDBSqlClientEncryptionKeyResource, please refer to the document of CosmosDBSqlClientEncryptionKeyResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + string clientEncryptionKeyName = "cekName"; + ResourceIdentifier cosmosDBSqlClientEncryptionKeyResourceId = CosmosDBSqlClientEncryptionKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, clientEncryptionKeyName); + CosmosDBSqlClientEncryptionKeyResource cosmosDBSqlClientEncryptionKey = client.GetCosmosDBSqlClientEncryptionKeyResource(cosmosDBSqlClientEncryptionKeyResourceId); + + // invoke the operation + CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent content = new CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(new CosmosDBSqlClientEncryptionKeyResourceInfo() + { + Id = "cekName", + EncryptionAlgorithm = "AEAD_AES_256_CBC_HMAC_SHA256", + WrappedDataEncryptionKey = Convert.FromBase64String("VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU="), + KeyWrapMetadata = new CosmosDBKeyWrapMetadata() + { + Name = "customerManagedKey", + CosmosDBKeyWrapMetadataType = "AzureKeyVault", + Value = "AzureKeyVault Key URL", + Algorithm = "RSA-OAEP", + }, + }); + ArmOperation lro = await cosmosDBSqlClientEncryptionKey.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlClientEncryptionKeyResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerCollection.cs new file mode 100644 index 0000000000000..fb60bcabc5d47 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerCollection.cs @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlContainerCollection + { + // CosmosDBSqlContainerList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlContainerList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerList.json + // this example is just showing the usage of "SqlResources_ListSqlContainers" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlContainerResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlContainerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlContainerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerGet.json + // this example is just showing the usage of "SqlResources_GetSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "containerName"; + CosmosDBSqlContainerResource result = await collection.GetAsync(containerName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlContainerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerGet.json + // this example is just showing the usage of "SqlResources_GetSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "containerName"; + bool result = await collection.ExistsAsync(containerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlContainerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlContainerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerGet.json + // this example is just showing the usage of "SqlResources_GetSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "containerName"; + NullableResponse response = await collection.GetIfExistsAsync(containerName); + CosmosDBSqlContainerResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlContainerCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlContainerCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "containerName"; + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("containerName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/AccountNumber" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + DefaultTtl = 100, + UniqueKeys = +{ +new CosmosDBUniqueKey() +{ +Paths = +{ +"/testPath" +}, +} +}, + ConflictResolutionPolicy = new ConflictResolutionPolicy() + { + Mode = ConflictResolutionMode.LastWriterWins, + ConflictResolutionPath = "/path", + }, + ClientEncryptionPolicy = new CosmosDBClientEncryptionPolicy(new CosmosDBClientEncryptionIncludedPath[] + { +new CosmosDBClientEncryptionIncludedPath("/path","keyId","Deterministic","AEAD_AES_256_CBC_HMAC_SHA256") + }, 2), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, containerName, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlContainerRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerRestore.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "containerName"; + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("containerName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, containerName, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlMaterializedViewCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlMaterializedViewCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlMaterializedViewCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "mvContainerName"; + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("mvContainerName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/mvpk" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + MaterializedViewDefinition = new MaterializedViewDefinition("sourceContainerName", "select * from ROOT"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, containerName, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerResource.cs new file mode 100644 index 0000000000000..3138bd98fd1d8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerResource.cs @@ -0,0 +1,381 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlContainerResource + { + // CosmosDBSqlContainerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlContainerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerGet.json + // this example is just showing the usage of "SqlResources_GetSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + CosmosDBSqlContainerResource result = await cosmosDBSqlContainer.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlContainerCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("containerName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/AccountNumber" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + DefaultTtl = 100, + UniqueKeys = +{ +new CosmosDBUniqueKey() +{ +Paths = +{ +"/testPath" +}, +} +}, + ConflictResolutionPolicy = new ConflictResolutionPolicy() + { + Mode = ConflictResolutionMode.LastWriterWins, + ConflictResolutionPath = "/path", + }, + ClientEncryptionPolicy = new CosmosDBClientEncryptionPolicy(new CosmosDBClientEncryptionIncludedPath[] + { +new CosmosDBClientEncryptionIncludedPath("/path","keyId","Deterministic","AEAD_AES_256_CBC_HMAC_SHA256") + }, 2), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlContainer.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlContainerRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerRestore.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("containerName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlContainer.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlMaterializedViewCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlMaterializedViewCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlMaterializedViewCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "mvContainerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("mvContainerName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/mvpk" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + MaterializedViewDefinition = new MaterializedViewDefinition("sourceContainerName", "select * from ROOT"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlContainer.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlContainerDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + await cosmosDBSqlContainer.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlContainerPartitionMerge + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSqlContainerPartitionMerge_CosmosDBSqlContainerPartitionMerge() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerPartitionMerge.json + // this example is just showing the usage of "SqlResources_ListSqlContainerPartitionMerge" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + MergeParameters mergeParameters = new MergeParameters() + { + IsDryRun = false, + }; + ArmOperation lro = await cosmosDBSqlContainer.GetSqlContainerPartitionMergeAsync(WaitUntil.Completed, mergeParameters); + PhysicalPartitionStorageInfoCollection result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlContainerBackupInformation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RetrieveContinuousBackupInformation_CosmosDBSqlContainerBackupInformation() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerBackupInformation.json + // this example is just showing the usage of "SqlResources_RetrieveContinuousBackupInformation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + ContinuousBackupRestoreLocation location = new ContinuousBackupRestoreLocation() + { + Location = new AzureLocation("North Europe"), + }; + ArmOperation lro = await cosmosDBSqlContainer.RetrieveContinuousBackupInformationAsync(WaitUntil.Completed, location); + CosmosDBBackupInformation result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerThroughputSettingResource.cs new file mode 100644 index 0000000000000..35dde54f1ac6b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerThroughputSettingResource.cs @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlContainerThroughputSettingResource + { + // CosmosDBSqlContainerThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlContainerThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerThroughputGet.json + // this example is just showing the usage of "SqlResources_GetSqlContainerThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + CosmosDBSqlContainerThroughputSettingResource result = await cosmosDBSqlContainerThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlContainerThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerThroughputUpdate.json + // this example is just showing the usage of "SqlResources_UpdateSqlContainerThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlContainerThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CosmosDBSqlContainerThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateSqlContainerToAutoscale_CosmosDBSqlContainerMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerMigrateToAutoscale.json + // this example is just showing the usage of "SqlResources_MigrateSqlContainerToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosDBSqlContainerThroughputSetting.MigrateSqlContainerToAutoscaleAsync(WaitUntil.Completed); + CosmosDBSqlContainerThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateSqlContainerToManualThroughput_CosmosDBSqlContainerMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerMigrateToManualThroughput.json + // this example is just showing the usage of "SqlResources_MigrateSqlContainerToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosDBSqlContainerThroughputSetting.MigrateSqlContainerToManualThroughputAsync(WaitUntil.Completed); + CosmosDBSqlContainerThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerRetrieveThroughputDistribution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SqlContainerRetrieveThroughputDistribution_CosmosDBSqlContainerRetrieveThroughputDistribution() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerRetrieveThroughputDistribution.json + // this example is just showing the usage of "SqlResources_SqlContainerRetrieveThroughputDistribution" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + RetrieveThroughputParameters retrieveThroughputParameters = new RetrieveThroughputParameters(new AzureLocation("placeholder"), new RetrieveThroughputPropertiesResource(new WritableSubResource[] + { +new WritableSubResource() +{ +Id = new ResourceIdentifier("0"), +},new WritableSubResource() +{ +Id = new ResourceIdentifier("1"), +} + })); + ArmOperation lro = await cosmosDBSqlContainerThroughputSetting.SqlContainerRetrieveThroughputDistributionAsync(WaitUntil.Completed, retrieveThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlContainerRedistributeThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SqlContainerRedistributeThroughput_CosmosDBSqlContainerRedistributeThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerRedistributeThroughput.json + // this example is just showing the usage of "SqlResources_SqlContainerRedistributeThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + RedistributeThroughputParameters redistributeThroughputParameters = new RedistributeThroughputParameters(new AzureLocation("placeholder"), new RedistributeThroughputPropertiesResource(ThroughputPolicyType.Custom, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("0") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("1") +{ +Throughput = 5000, +} + }, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("2") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("3") + })); + ArmOperation lro = await cosmosDBSqlContainerThroughputSetting.SqlContainerRedistributeThroughputAsync(WaitUntil.Completed, redistributeThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseCollection.cs new file mode 100644 index 0000000000000..938655847819e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseCollection.cs @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlDatabaseCollection + { + // CosmosDBSqlDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseList.json + // this example is just showing the usage of "SqlResources_ListSqlDatabases" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlDatabaseResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseGet.json + // this example is just showing the usage of "SqlResources_GetSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + CosmosDBSqlDatabaseResource result = await collection.GetAsync(databaseName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseGet.json + // this example is just showing the usage of "SqlResources_GetSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + bool result = await collection.ExistsAsync(databaseName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseGet.json + // this example is just showing the usage of "SqlResources_GetSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + CosmosDBSqlDatabaseResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + CosmosDBSqlDatabaseCreateOrUpdateContent content = new CosmosDBSqlDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, content); + CosmosDBSqlDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlDatabaseRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseRestore.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + CosmosDBSqlDatabaseCreateOrUpdateContent content = new CosmosDBSqlDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlDatabaseResourceInfo("databaseName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, content); + CosmosDBSqlDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseResource.cs new file mode 100644 index 0000000000000..d4e06876e1ef9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseResource.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlDatabaseResource + { + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseGet.json + // this example is just showing the usage of "SqlResources_GetSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // invoke the operation + CosmosDBSqlDatabaseResource result = await cosmosDBSqlDatabase.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // invoke the operation + CosmosDBSqlDatabaseCreateOrUpdateContent content = new CosmosDBSqlDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlDatabase.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlDatabaseRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseRestore.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // invoke the operation + CosmosDBSqlDatabaseCreateOrUpdateContent content = new CosmosDBSqlDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlDatabaseResourceInfo("databaseName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlDatabase.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlDatabaseDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // invoke the operation + await cosmosDBSqlDatabase.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlDatabasePartitionMerge + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SqlDatabasePartitionMerge_CosmosDBSqlDatabasePartitionMerge() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabasePartitionMerge.json + // this example is just showing the usage of "SqlResources_SqlDatabasePartitionMerge" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // invoke the operation + MergeParameters mergeParameters = new MergeParameters() + { + IsDryRun = false, + }; + ArmOperation lro = await cosmosDBSqlDatabase.SqlDatabasePartitionMergeAsync(WaitUntil.Completed, mergeParameters); + PhysicalPartitionStorageInfoCollection result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseThroughputSettingResource.cs new file mode 100644 index 0000000000000..95855dda78990 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseThroughputSettingResource.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlDatabaseThroughputSettingResource + { + // CosmosDBSqlDatabaseThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlDatabaseThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseThroughputGet.json + // this example is just showing the usage of "SqlResources_GetSqlDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + CosmosDBSqlDatabaseThroughputSettingResource result = await cosmosDBSqlDatabaseThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlDatabaseThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseThroughputUpdate.json + // this example is just showing the usage of "SqlResources_UpdateSqlDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlDatabaseThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CosmosDBSqlDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateSqlDatabaseToAutoscale_CosmosDBSqlDatabaseMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseMigrateToAutoscale.json + // this example is just showing the usage of "SqlResources_MigrateSqlDatabaseToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosDBSqlDatabaseThroughputSetting.MigrateSqlDatabaseToAutoscaleAsync(WaitUntil.Completed); + CosmosDBSqlDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateSqlDatabaseToManualThroughput_CosmosDBSqlDatabaseMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseMigrateToManualThroughput.json + // this example is just showing the usage of "SqlResources_MigrateSqlDatabaseToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosDBSqlDatabaseThroughputSetting.MigrateSqlDatabaseToManualThroughputAsync(WaitUntil.Completed); + CosmosDBSqlDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseRetrieveThroughputDistribution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SqlDatabaseRetrieveThroughputDistribution_CosmosDBSqlDatabaseRetrieveThroughputDistribution() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseRetrieveThroughputDistribution.json + // this example is just showing the usage of "SqlResources_SqlDatabaseRetrieveThroughputDistribution" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + RetrieveThroughputParameters retrieveThroughputParameters = new RetrieveThroughputParameters(new AzureLocation("placeholder"), new RetrieveThroughputPropertiesResource(new WritableSubResource[] + { +new WritableSubResource() +{ +Id = new ResourceIdentifier("0"), +},new WritableSubResource() +{ +Id = new ResourceIdentifier("1"), +} + })); + ArmOperation lro = await cosmosDBSqlDatabaseThroughputSetting.SqlDatabaseRetrieveThroughputDistributionAsync(WaitUntil.Completed, retrieveThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlDatabaseRedistributeThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SqlDatabaseRedistributeThroughput_CosmosDBSqlDatabaseRedistributeThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseRedistributeThroughput.json + // this example is just showing the usage of "SqlResources_SqlDatabaseRedistributeThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + RedistributeThroughputParameters redistributeThroughputParameters = new RedistributeThroughputParameters(new AzureLocation("placeholder"), new RedistributeThroughputPropertiesResource(ThroughputPolicyType.Custom, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("0") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("1") +{ +Throughput = 5000, +} + }, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("2") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("3") + })); + ArmOperation lro = await cosmosDBSqlDatabaseThroughputSetting.SqlDatabaseRedistributeThroughputAsync(WaitUntil.Completed, redistributeThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentCollection.cs new file mode 100644 index 0000000000000..6a32c38f664b7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentCollection.cs @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlRoleAssignmentCollection + { + // CosmosDBSqlRoleAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlRoleAssignmentGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleAssignmentResource + CosmosDBSqlRoleAssignmentCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleAssignments(); + + // invoke the operation + string roleAssignmentId = "myRoleAssignmentId"; + CosmosDBSqlRoleAssignmentResource result = await collection.GetAsync(roleAssignmentId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlRoleAssignmentGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleAssignmentResource + CosmosDBSqlRoleAssignmentCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleAssignments(); + + // invoke the operation + string roleAssignmentId = "myRoleAssignmentId"; + bool result = await collection.ExistsAsync(roleAssignmentId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlRoleAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlRoleAssignmentGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleAssignmentResource + CosmosDBSqlRoleAssignmentCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleAssignments(); + + // invoke the operation + string roleAssignmentId = "myRoleAssignmentId"; + NullableResponse response = await collection.GetIfExistsAsync(roleAssignmentId); + CosmosDBSqlRoleAssignmentResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlRoleAssignmentCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlRoleAssignmentCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleAssignmentResource + CosmosDBSqlRoleAssignmentCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleAssignments(); + + // invoke the operation + string roleAssignmentId = "myRoleAssignmentId"; + CosmosDBSqlRoleAssignmentCreateOrUpdateContent content = new CosmosDBSqlRoleAssignmentCreateOrUpdateContent() + { + RoleDefinitionId = new ResourceIdentifier("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId"), + Scope = "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases", + PrincipalId = Guid.Parse("myPrincipalId"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, roleAssignmentId, content); + CosmosDBSqlRoleAssignmentResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleAssignmentList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlRoleAssignmentList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentList.json + // this example is just showing the usage of "SqlResources_ListSqlRoleAssignments" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleAssignmentResource + CosmosDBSqlRoleAssignmentCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleAssignments(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlRoleAssignmentResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentResource.cs new file mode 100644 index 0000000000000..ae77f210f748e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlRoleAssignmentResource + { + // CosmosDBSqlRoleAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlRoleAssignmentGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleAssignmentResource created on azure + // for more information of creating CosmosDBSqlRoleAssignmentResource, please refer to the document of CosmosDBSqlRoleAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleAssignmentId = "myRoleAssignmentId"; + ResourceIdentifier cosmosDBSqlRoleAssignmentResourceId = CosmosDBSqlRoleAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleAssignmentId); + CosmosDBSqlRoleAssignmentResource cosmosDBSqlRoleAssignment = client.GetCosmosDBSqlRoleAssignmentResource(cosmosDBSqlRoleAssignmentResourceId); + + // invoke the operation + CosmosDBSqlRoleAssignmentResource result = await cosmosDBSqlRoleAssignment.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleAssignmentCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlRoleAssignmentCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleAssignmentResource created on azure + // for more information of creating CosmosDBSqlRoleAssignmentResource, please refer to the document of CosmosDBSqlRoleAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleAssignmentId = "myRoleAssignmentId"; + ResourceIdentifier cosmosDBSqlRoleAssignmentResourceId = CosmosDBSqlRoleAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleAssignmentId); + CosmosDBSqlRoleAssignmentResource cosmosDBSqlRoleAssignment = client.GetCosmosDBSqlRoleAssignmentResource(cosmosDBSqlRoleAssignmentResourceId); + + // invoke the operation + CosmosDBSqlRoleAssignmentCreateOrUpdateContent content = new CosmosDBSqlRoleAssignmentCreateOrUpdateContent() + { + RoleDefinitionId = new ResourceIdentifier("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId"), + Scope = "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases", + PrincipalId = Guid.Parse("myPrincipalId"), + }; + ArmOperation lro = await cosmosDBSqlRoleAssignment.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlRoleAssignmentResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleAssignmentDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlRoleAssignmentDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleAssignmentResource created on azure + // for more information of creating CosmosDBSqlRoleAssignmentResource, please refer to the document of CosmosDBSqlRoleAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleAssignmentId = "myRoleAssignmentId"; + ResourceIdentifier cosmosDBSqlRoleAssignmentResourceId = CosmosDBSqlRoleAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleAssignmentId); + CosmosDBSqlRoleAssignmentResource cosmosDBSqlRoleAssignment = client.GetCosmosDBSqlRoleAssignmentResource(cosmosDBSqlRoleAssignmentResourceId); + + // invoke the operation + await cosmosDBSqlRoleAssignment.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionCollection.cs new file mode 100644 index 0000000000000..79e6ba81a3123 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionCollection.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlRoleDefinitionCollection + { + // CosmosDBSqlRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleDefinitionResource + CosmosDBSqlRoleDefinitionCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleDefinitions(); + + // invoke the operation + string roleDefinitionId = "myRoleDefinitionId"; + CosmosDBSqlRoleDefinitionResource result = await collection.GetAsync(roleDefinitionId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleDefinitionResource + CosmosDBSqlRoleDefinitionCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleDefinitions(); + + // invoke the operation + string roleDefinitionId = "myRoleDefinitionId"; + bool result = await collection.ExistsAsync(roleDefinitionId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleDefinitionResource + CosmosDBSqlRoleDefinitionCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleDefinitions(); + + // invoke the operation + string roleDefinitionId = "myRoleDefinitionId"; + NullableResponse response = await collection.GetIfExistsAsync(roleDefinitionId); + CosmosDBSqlRoleDefinitionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlRoleDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlRoleDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleDefinitionResource + CosmosDBSqlRoleDefinitionCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleDefinitions(); + + // invoke the operation + string roleDefinitionId = "myRoleDefinitionId"; + CosmosDBSqlRoleDefinitionCreateOrUpdateContent content = new CosmosDBSqlRoleDefinitionCreateOrUpdateContent() + { + RoleName = "myRoleName", + RoleDefinitionType = CosmosDBSqlRoleDefinitionType.CustomRole, + AssignableScopes = +{ +"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales","/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases" +}, + Permissions = +{ +new CosmosDBSqlRolePermission() +{ +DataActions = +{ +"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create","Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read" +}, +NotDataActions = +{ +}, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, roleDefinitionId, content); + CosmosDBSqlRoleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleDefinitionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlRoleDefinitionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionList.json + // this example is just showing the usage of "SqlResources_ListSqlRoleDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleDefinitionResource + CosmosDBSqlRoleDefinitionCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleDefinitions(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlRoleDefinitionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionResource.cs new file mode 100644 index 0000000000000..6d539b53bac2a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionResource.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlRoleDefinitionResource + { + // CosmosDBSqlRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleDefinitionResource created on azure + // for more information of creating CosmosDBSqlRoleDefinitionResource, please refer to the document of CosmosDBSqlRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleDefinitionId = "myRoleDefinitionId"; + ResourceIdentifier cosmosDBSqlRoleDefinitionResourceId = CosmosDBSqlRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleDefinitionId); + CosmosDBSqlRoleDefinitionResource cosmosDBSqlRoleDefinition = client.GetCosmosDBSqlRoleDefinitionResource(cosmosDBSqlRoleDefinitionResourceId); + + // invoke the operation + CosmosDBSqlRoleDefinitionResource result = await cosmosDBSqlRoleDefinition.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlRoleDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleDefinitionResource created on azure + // for more information of creating CosmosDBSqlRoleDefinitionResource, please refer to the document of CosmosDBSqlRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleDefinitionId = "myRoleDefinitionId"; + ResourceIdentifier cosmosDBSqlRoleDefinitionResourceId = CosmosDBSqlRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleDefinitionId); + CosmosDBSqlRoleDefinitionResource cosmosDBSqlRoleDefinition = client.GetCosmosDBSqlRoleDefinitionResource(cosmosDBSqlRoleDefinitionResourceId); + + // invoke the operation + CosmosDBSqlRoleDefinitionCreateOrUpdateContent content = new CosmosDBSqlRoleDefinitionCreateOrUpdateContent() + { + RoleName = "myRoleName", + RoleDefinitionType = CosmosDBSqlRoleDefinitionType.CustomRole, + AssignableScopes = +{ +"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales","/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases" +}, + Permissions = +{ +new CosmosDBSqlRolePermission() +{ +DataActions = +{ +"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create","Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read" +}, +NotDataActions = +{ +}, +} +}, + }; + ArmOperation lro = await cosmosDBSqlRoleDefinition.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlRoleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleDefinitionDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlRoleDefinitionDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleDefinitionResource created on azure + // for more information of creating CosmosDBSqlRoleDefinitionResource, please refer to the document of CosmosDBSqlRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleDefinitionId = "myRoleDefinitionId"; + ResourceIdentifier cosmosDBSqlRoleDefinitionResourceId = CosmosDBSqlRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleDefinitionId); + CosmosDBSqlRoleDefinitionResource cosmosDBSqlRoleDefinition = client.GetCosmosDBSqlRoleDefinitionResource(cosmosDBSqlRoleDefinitionResourceId); + + // invoke the operation + await cosmosDBSqlRoleDefinition.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureCollection.cs new file mode 100644 index 0000000000000..11f99aa3abe8d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureCollection.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlStoredProcedureCollection + { + // CosmosDBSqlStoredProcedureList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlStoredProcedureList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureList.json + // this example is just showing the usage of "SqlResources_ListSqlStoredProcedures" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlStoredProcedureResource + CosmosDBSqlStoredProcedureCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlStoredProcedures(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlStoredProcedureResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlStoredProcedureGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlStoredProcedureGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureGet.json + // this example is just showing the usage of "SqlResources_GetSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlStoredProcedureResource + CosmosDBSqlStoredProcedureCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlStoredProcedures(); + + // invoke the operation + string storedProcedureName = "storedProcedureName"; + CosmosDBSqlStoredProcedureResource result = await collection.GetAsync(storedProcedureName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlStoredProcedureGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlStoredProcedureGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureGet.json + // this example is just showing the usage of "SqlResources_GetSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlStoredProcedureResource + CosmosDBSqlStoredProcedureCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlStoredProcedures(); + + // invoke the operation + string storedProcedureName = "storedProcedureName"; + bool result = await collection.ExistsAsync(storedProcedureName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlStoredProcedureGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlStoredProcedureGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureGet.json + // this example is just showing the usage of "SqlResources_GetSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlStoredProcedureResource + CosmosDBSqlStoredProcedureCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlStoredProcedures(); + + // invoke the operation + string storedProcedureName = "storedProcedureName"; + NullableResponse response = await collection.GetIfExistsAsync(storedProcedureName); + CosmosDBSqlStoredProcedureResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlStoredProcedureCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlStoredProcedureCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlStoredProcedureResource + CosmosDBSqlStoredProcedureCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlStoredProcedures(); + + // invoke the operation + string storedProcedureName = "storedProcedureName"; + CosmosDBSqlStoredProcedureCreateOrUpdateContent content = new CosmosDBSqlStoredProcedureCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlStoredProcedureResourceInfo("storedProcedureName") + { + Body = "body", + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, storedProcedureName, content); + CosmosDBSqlStoredProcedureResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureResource.cs new file mode 100644 index 0000000000000..6b398ae6dbf54 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureResource.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlStoredProcedureResource + { + // CosmosDBSqlStoredProcedureGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlStoredProcedureGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureGet.json + // this example is just showing the usage of "SqlResources_GetSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlStoredProcedureResource created on azure + // for more information of creating CosmosDBSqlStoredProcedureResource, please refer to the document of CosmosDBSqlStoredProcedureResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string storedProcedureName = "storedProcedureName"; + ResourceIdentifier cosmosDBSqlStoredProcedureResourceId = CosmosDBSqlStoredProcedureResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + CosmosDBSqlStoredProcedureResource cosmosDBSqlStoredProcedure = client.GetCosmosDBSqlStoredProcedureResource(cosmosDBSqlStoredProcedureResourceId); + + // invoke the operation + CosmosDBSqlStoredProcedureResource result = await cosmosDBSqlStoredProcedure.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlStoredProcedureCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlStoredProcedureCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlStoredProcedureResource created on azure + // for more information of creating CosmosDBSqlStoredProcedureResource, please refer to the document of CosmosDBSqlStoredProcedureResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string storedProcedureName = "storedProcedureName"; + ResourceIdentifier cosmosDBSqlStoredProcedureResourceId = CosmosDBSqlStoredProcedureResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + CosmosDBSqlStoredProcedureResource cosmosDBSqlStoredProcedure = client.GetCosmosDBSqlStoredProcedureResource(cosmosDBSqlStoredProcedureResourceId); + + // invoke the operation + CosmosDBSqlStoredProcedureCreateOrUpdateContent content = new CosmosDBSqlStoredProcedureCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlStoredProcedureResourceInfo("storedProcedureName") + { + Body = "body", + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await cosmosDBSqlStoredProcedure.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlStoredProcedureResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlStoredProcedureDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlStoredProcedureDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlStoredProcedureResource created on azure + // for more information of creating CosmosDBSqlStoredProcedureResource, please refer to the document of CosmosDBSqlStoredProcedureResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string storedProcedureName = "storedProcedureName"; + ResourceIdentifier cosmosDBSqlStoredProcedureResourceId = CosmosDBSqlStoredProcedureResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + CosmosDBSqlStoredProcedureResource cosmosDBSqlStoredProcedure = client.GetCosmosDBSqlStoredProcedureResource(cosmosDBSqlStoredProcedureResourceId); + + // invoke the operation + await cosmosDBSqlStoredProcedure.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerCollection.cs new file mode 100644 index 0000000000000..f5d386f62c2a4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerCollection.cs @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlTriggerCollection + { + // CosmosDBSqlTriggerList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlTriggerList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerList.json + // this example is just showing the usage of "SqlResources_ListSqlTriggers" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlTriggerResource + CosmosDBSqlTriggerCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlTriggers(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlTriggerResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlTriggerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlTriggerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerGet.json + // this example is just showing the usage of "SqlResources_GetSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlTriggerResource + CosmosDBSqlTriggerCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlTriggers(); + + // invoke the operation + string triggerName = "triggerName"; + CosmosDBSqlTriggerResource result = await collection.GetAsync(triggerName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlTriggerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlTriggerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerGet.json + // this example is just showing the usage of "SqlResources_GetSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlTriggerResource + CosmosDBSqlTriggerCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlTriggers(); + + // invoke the operation + string triggerName = "triggerName"; + bool result = await collection.ExistsAsync(triggerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlTriggerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlTriggerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerGet.json + // this example is just showing the usage of "SqlResources_GetSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlTriggerResource + CosmosDBSqlTriggerCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlTriggers(); + + // invoke the operation + string triggerName = "triggerName"; + NullableResponse response = await collection.GetIfExistsAsync(triggerName); + CosmosDBSqlTriggerResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlTriggerCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlTriggerCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlTriggerResource + CosmosDBSqlTriggerCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlTriggers(); + + // invoke the operation + string triggerName = "triggerName"; + CosmosDBSqlTriggerCreateOrUpdateContent content = new CosmosDBSqlTriggerCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlTriggerResourceInfo("triggerName") + { + Body = "body", + TriggerType = new CosmosDBSqlTriggerType("triggerType"), + TriggerOperation = new CosmosDBSqlTriggerOperation("triggerOperation"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, triggerName, content); + CosmosDBSqlTriggerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerResource.cs new file mode 100644 index 0000000000000..6819bcde3d7c2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerResource.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlTriggerResource + { + // CosmosDBSqlTriggerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlTriggerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerGet.json + // this example is just showing the usage of "SqlResources_GetSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlTriggerResource created on azure + // for more information of creating CosmosDBSqlTriggerResource, please refer to the document of CosmosDBSqlTriggerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string triggerName = "triggerName"; + ResourceIdentifier cosmosDBSqlTriggerResourceId = CosmosDBSqlTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, triggerName); + CosmosDBSqlTriggerResource cosmosDBSqlTrigger = client.GetCosmosDBSqlTriggerResource(cosmosDBSqlTriggerResourceId); + + // invoke the operation + CosmosDBSqlTriggerResource result = await cosmosDBSqlTrigger.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlTriggerCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlTriggerCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlTriggerResource created on azure + // for more information of creating CosmosDBSqlTriggerResource, please refer to the document of CosmosDBSqlTriggerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string triggerName = "triggerName"; + ResourceIdentifier cosmosDBSqlTriggerResourceId = CosmosDBSqlTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, triggerName); + CosmosDBSqlTriggerResource cosmosDBSqlTrigger = client.GetCosmosDBSqlTriggerResource(cosmosDBSqlTriggerResourceId); + + // invoke the operation + CosmosDBSqlTriggerCreateOrUpdateContent content = new CosmosDBSqlTriggerCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlTriggerResourceInfo("triggerName") + { + Body = "body", + TriggerType = new CosmosDBSqlTriggerType("triggerType"), + TriggerOperation = new CosmosDBSqlTriggerOperation("triggerOperation"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await cosmosDBSqlTrigger.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlTriggerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlTriggerDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlTriggerDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlTriggerResource created on azure + // for more information of creating CosmosDBSqlTriggerResource, please refer to the document of CosmosDBSqlTriggerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string triggerName = "triggerName"; + ResourceIdentifier cosmosDBSqlTriggerResourceId = CosmosDBSqlTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, triggerName); + CosmosDBSqlTriggerResource cosmosDBSqlTrigger = client.GetCosmosDBSqlTriggerResource(cosmosDBSqlTriggerResourceId); + + // invoke the operation + await cosmosDBSqlTrigger.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionCollection.cs new file mode 100644 index 0000000000000..9491d2193bb07 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionCollection.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlUserDefinedFunctionCollection + { + // CosmosDBSqlUserDefinedFunctionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlUserDefinedFunctionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionList.json + // this example is just showing the usage of "SqlResources_ListSqlUserDefinedFunctions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlUserDefinedFunctionResource + CosmosDBSqlUserDefinedFunctionCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlUserDefinedFunctions(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlUserDefinedFunctionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlUserDefinedFunctionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlUserDefinedFunctionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json + // this example is just showing the usage of "SqlResources_GetSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlUserDefinedFunctionResource + CosmosDBSqlUserDefinedFunctionCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlUserDefinedFunctions(); + + // invoke the operation + string userDefinedFunctionName = "userDefinedFunctionName"; + CosmosDBSqlUserDefinedFunctionResource result = await collection.GetAsync(userDefinedFunctionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlUserDefinedFunctionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlUserDefinedFunctionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json + // this example is just showing the usage of "SqlResources_GetSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlUserDefinedFunctionResource + CosmosDBSqlUserDefinedFunctionCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlUserDefinedFunctions(); + + // invoke the operation + string userDefinedFunctionName = "userDefinedFunctionName"; + bool result = await collection.ExistsAsync(userDefinedFunctionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlUserDefinedFunctionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlUserDefinedFunctionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json + // this example is just showing the usage of "SqlResources_GetSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlUserDefinedFunctionResource + CosmosDBSqlUserDefinedFunctionCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlUserDefinedFunctions(); + + // invoke the operation + string userDefinedFunctionName = "userDefinedFunctionName"; + NullableResponse response = await collection.GetIfExistsAsync(userDefinedFunctionName); + CosmosDBSqlUserDefinedFunctionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlUserDefinedFunctionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlUserDefinedFunctionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlUserDefinedFunctionResource + CosmosDBSqlUserDefinedFunctionCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlUserDefinedFunctions(); + + // invoke the operation + string userDefinedFunctionName = "userDefinedFunctionName"; + CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent content = new CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlUserDefinedFunctionResourceInfo("userDefinedFunctionName") + { + Body = "body", + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, userDefinedFunctionName, content); + CosmosDBSqlUserDefinedFunctionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionResource.cs new file mode 100644 index 0000000000000..f183d0fc9d267 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionResource.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlUserDefinedFunctionResource + { + // CosmosDBSqlUserDefinedFunctionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlUserDefinedFunctionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json + // this example is just showing the usage of "SqlResources_GetSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlUserDefinedFunctionResource created on azure + // for more information of creating CosmosDBSqlUserDefinedFunctionResource, please refer to the document of CosmosDBSqlUserDefinedFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string userDefinedFunctionName = "userDefinedFunctionName"; + ResourceIdentifier cosmosDBSqlUserDefinedFunctionResourceId = CosmosDBSqlUserDefinedFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + CosmosDBSqlUserDefinedFunctionResource cosmosDBSqlUserDefinedFunction = client.GetCosmosDBSqlUserDefinedFunctionResource(cosmosDBSqlUserDefinedFunctionResourceId); + + // invoke the operation + CosmosDBSqlUserDefinedFunctionResource result = await cosmosDBSqlUserDefinedFunction.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlUserDefinedFunctionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlUserDefinedFunctionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlUserDefinedFunctionResource created on azure + // for more information of creating CosmosDBSqlUserDefinedFunctionResource, please refer to the document of CosmosDBSqlUserDefinedFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string userDefinedFunctionName = "userDefinedFunctionName"; + ResourceIdentifier cosmosDBSqlUserDefinedFunctionResourceId = CosmosDBSqlUserDefinedFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + CosmosDBSqlUserDefinedFunctionResource cosmosDBSqlUserDefinedFunction = client.GetCosmosDBSqlUserDefinedFunctionResource(cosmosDBSqlUserDefinedFunctionResourceId); + + // invoke the operation + CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent content = new CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlUserDefinedFunctionResourceInfo("userDefinedFunctionName") + { + Body = "body", + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await cosmosDBSqlUserDefinedFunction.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlUserDefinedFunctionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlUserDefinedFunctionDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlUserDefinedFunctionDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlUserDefinedFunctionResource created on azure + // for more information of creating CosmosDBSqlUserDefinedFunctionResource, please refer to the document of CosmosDBSqlUserDefinedFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string userDefinedFunctionName = "userDefinedFunctionName"; + ResourceIdentifier cosmosDBSqlUserDefinedFunctionResourceId = CosmosDBSqlUserDefinedFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + CosmosDBSqlUserDefinedFunctionResource cosmosDBSqlUserDefinedFunction = client.GetCosmosDBSqlUserDefinedFunctionResource(cosmosDBSqlUserDefinedFunctionResourceId); + + // invoke the operation + await cosmosDBSqlUserDefinedFunction.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableCollection.cs new file mode 100644 index 0000000000000..c483a7857d339 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableCollection.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBTableCollection + { + // CosmosDBTableList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBTableList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableList.json + // this example is just showing the usage of "TableResources_ListTables" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBTableResource + CosmosDBTableCollection collection = cosmosDBAccount.GetCosmosDBTables(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBTableResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableGet.json + // this example is just showing the usage of "TableResources_GetTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBTableResource + CosmosDBTableCollection collection = cosmosDBAccount.GetCosmosDBTables(); + + // invoke the operation + string tableName = "tableName"; + CosmosDBTableResource result = await collection.GetAsync(tableName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableGet.json + // this example is just showing the usage of "TableResources_GetTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBTableResource + CosmosDBTableCollection collection = cosmosDBAccount.GetCosmosDBTables(); + + // invoke the operation + string tableName = "tableName"; + bool result = await collection.ExistsAsync(tableName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableGet.json + // this example is just showing the usage of "TableResources_GetTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBTableResource + CosmosDBTableCollection collection = cosmosDBAccount.GetCosmosDBTables(); + + // invoke the operation + string tableName = "tableName"; + NullableResponse response = await collection.GetIfExistsAsync(tableName); + CosmosDBTableResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBTableReplace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBTableReplace() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableCreateUpdate.json + // this example is just showing the usage of "TableResources_CreateUpdateTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBTableResource + CosmosDBTableCollection collection = cosmosDBAccount.GetCosmosDBTables(); + + // invoke the operation + string tableName = "tableName"; + CosmosDBTableCreateOrUpdateContent content = new CosmosDBTableCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBTableResourceInfo("tableName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, tableName, content); + CosmosDBTableResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableResource.cs new file mode 100644 index 0000000000000..42cab74d969da --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableResource.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBTableResource + { + // CosmosDBTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableGet.json + // this example is just showing the usage of "TableResources_GetTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBTableResource created on azure + // for more information of creating CosmosDBTableResource, please refer to the document of CosmosDBTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosDBTableResourceId = CosmosDBTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosDBTableResource cosmosDBTable = client.GetCosmosDBTableResource(cosmosDBTableResourceId); + + // invoke the operation + CosmosDBTableResource result = await cosmosDBTable.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableReplace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBTableReplace() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableCreateUpdate.json + // this example is just showing the usage of "TableResources_CreateUpdateTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBTableResource created on azure + // for more information of creating CosmosDBTableResource, please refer to the document of CosmosDBTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosDBTableResourceId = CosmosDBTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosDBTableResource cosmosDBTable = client.GetCosmosDBTableResource(cosmosDBTableResourceId); + + // invoke the operation + CosmosDBTableCreateOrUpdateContent content = new CosmosDBTableCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBTableResourceInfo("tableName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBTable.UpdateAsync(WaitUntil.Completed, content); + CosmosDBTableResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBTableDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableDelete.json + // this example is just showing the usage of "TableResources_DeleteTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBTableResource created on azure + // for more information of creating CosmosDBTableResource, please refer to the document of CosmosDBTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosDBTableResourceId = CosmosDBTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosDBTableResource cosmosDBTable = client.GetCosmosDBTableResource(cosmosDBTableResourceId); + + // invoke the operation + await cosmosDBTable.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBTableCollectionBackupInformation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RetrieveContinuousBackupInformation_CosmosDBTableCollectionBackupInformation() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableBackupInformation.json + // this example is just showing the usage of "TableResources_RetrieveContinuousBackupInformation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBTableResource created on azure + // for more information of creating CosmosDBTableResource, please refer to the document of CosmosDBTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string tableName = "tableName1"; + ResourceIdentifier cosmosDBTableResourceId = CosmosDBTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosDBTableResource cosmosDBTable = client.GetCosmosDBTableResource(cosmosDBTableResourceId); + + // invoke the operation + ContinuousBackupRestoreLocation location = new ContinuousBackupRestoreLocation() + { + Location = new AzureLocation("North Europe"), + }; + ArmOperation lro = await cosmosDBTable.RetrieveContinuousBackupInformationAsync(WaitUntil.Completed, location); + CosmosDBBackupInformation result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosTableThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosTableThroughputSettingResource.cs new file mode 100644 index 0000000000000..e787736174251 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosTableThroughputSettingResource.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosTableThroughputSettingResource + { + // CosmosDBTableThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBTableThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableThroughputGet.json + // this example is just showing the usage of "TableResources_GetTableThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosTableThroughputSettingResource created on azure + // for more information of creating CosmosTableThroughputSettingResource, please refer to the document of CosmosTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosTableThroughputSettingResourceId = CosmosTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosTableThroughputSettingResource cosmosTableThroughputSetting = client.GetCosmosTableThroughputSettingResource(cosmosTableThroughputSettingResourceId); + + // invoke the operation + CosmosTableThroughputSettingResource result = await cosmosTableThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBTableThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableThroughputUpdate.json + // this example is just showing the usage of "TableResources_UpdateTableThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosTableThroughputSettingResource created on azure + // for more information of creating CosmosTableThroughputSettingResource, please refer to the document of CosmosTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosTableThroughputSettingResourceId = CosmosTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosTableThroughputSettingResource cosmosTableThroughputSetting = client.GetCosmosTableThroughputSettingResource(cosmosTableThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cosmosTableThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CosmosTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateTableToAutoscale_CosmosDBTableMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableMigrateToAutoscale.json + // this example is just showing the usage of "TableResources_MigrateTableToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosTableThroughputSettingResource created on azure + // for more information of creating CosmosTableThroughputSettingResource, please refer to the document of CosmosTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosTableThroughputSettingResourceId = CosmosTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosTableThroughputSettingResource cosmosTableThroughputSetting = client.GetCosmosTableThroughputSettingResource(cosmosTableThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosTableThroughputSetting.MigrateTableToAutoscaleAsync(WaitUntil.Completed); + CosmosTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateTableToManualThroughput_CosmosDBTableMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableMigrateToManualThroughput.json + // this example is just showing the usage of "TableResources_MigrateTableToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosTableThroughputSettingResource created on azure + // for more information of creating CosmosTableThroughputSettingResource, please refer to the document of CosmosTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosTableThroughputSettingResourceId = CosmosTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosTableThroughputSettingResource cosmosTableThroughputSetting = client.GetCosmosTableThroughputSettingResource(cosmosTableThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosTableThroughputSetting.MigrateTableToManualThroughputAsync(WaitUntil.Completed); + CosmosTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultCollection.cs new file mode 100644 index 0000000000000..19227b1996e60 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultCollection.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_DataTransferJobGetResultCollection + { + // CosmosDBDataTransferJobCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBDataTransferJobCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobCreate.json + // this example is just showing the usage of "DataTransferJobs_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this DataTransferJobGetResultResource + DataTransferJobGetResultCollection collection = cosmosDBAccount.GetDataTransferJobGetResults(); + + // invoke the operation + string jobName = "j1"; + DataTransferJobGetResultCreateOrUpdateContent content = new DataTransferJobGetResultCreateOrUpdateContent(new DataTransferJobProperties(new CosmosCassandraDataTransferDataSourceSink("keyspace", "table"), new AzureBlobDataTransferDataSourceSink("blob_container") + { + EndpointUri = new Uri("https://blob.windows.net"), + })); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, jobName, content); + DataTransferJobGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBDataTransferJobGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobGet.json + // this example is just showing the usage of "DataTransferJobs_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this DataTransferJobGetResultResource + DataTransferJobGetResultCollection collection = cosmosDBAccount.GetDataTransferJobGetResults(); + + // invoke the operation + string jobName = "j1"; + DataTransferJobGetResultResource result = await collection.GetAsync(jobName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBDataTransferJobGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobGet.json + // this example is just showing the usage of "DataTransferJobs_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this DataTransferJobGetResultResource + DataTransferJobGetResultCollection collection = cosmosDBAccount.GetDataTransferJobGetResults(); + + // invoke the operation + string jobName = "j1"; + bool result = await collection.ExistsAsync(jobName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBDataTransferJobGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBDataTransferJobGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobGet.json + // this example is just showing the usage of "DataTransferJobs_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this DataTransferJobGetResultResource + DataTransferJobGetResultCollection collection = cosmosDBAccount.GetDataTransferJobGetResults(); + + // invoke the operation + string jobName = "j1"; + NullableResponse response = await collection.GetIfExistsAsync(jobName); + DataTransferJobGetResultResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBDataTransferJobFeed + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBDataTransferJobFeed() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobFeed.json + // this example is just showing the usage of "DataTransferJobs_ListByDatabaseAccount" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this DataTransferJobGetResultResource + DataTransferJobGetResultCollection collection = cosmosDBAccount.GetDataTransferJobGetResults(); + + // invoke the operation and iterate over the result + await foreach (DataTransferJobGetResultResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultResource.cs new file mode 100644 index 0000000000000..5469278f351ad --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultResource.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_DataTransferJobGetResultResource + { + // CosmosDBDataTransferJobCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBDataTransferJobCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobCreate.json + // this example is just showing the usage of "DataTransferJobs_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataTransferJobGetResultResource created on azure + // for more information of creating DataTransferJobGetResultResource, please refer to the document of DataTransferJobGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string jobName = "j1"; + ResourceIdentifier dataTransferJobGetResultResourceId = DataTransferJobGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, jobName); + DataTransferJobGetResultResource dataTransferJobGetResult = client.GetDataTransferJobGetResultResource(dataTransferJobGetResultResourceId); + + // invoke the operation + DataTransferJobGetResultCreateOrUpdateContent content = new DataTransferJobGetResultCreateOrUpdateContent(new DataTransferJobProperties(new CosmosCassandraDataTransferDataSourceSink("keyspace", "table"), new AzureBlobDataTransferDataSourceSink("blob_container") + { + EndpointUri = new Uri("https://blob.windows.net"), + })); + ArmOperation lro = await dataTransferJobGetResult.UpdateAsync(WaitUntil.Completed, content); + DataTransferJobGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBDataTransferJobGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobGet.json + // this example is just showing the usage of "DataTransferJobs_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataTransferJobGetResultResource created on azure + // for more information of creating DataTransferJobGetResultResource, please refer to the document of DataTransferJobGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string jobName = "j1"; + ResourceIdentifier dataTransferJobGetResultResourceId = DataTransferJobGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, jobName); + DataTransferJobGetResultResource dataTransferJobGetResult = client.GetDataTransferJobGetResultResource(dataTransferJobGetResultResourceId); + + // invoke the operation + DataTransferJobGetResultResource result = await dataTransferJobGetResult.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobPause + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Pause_CosmosDBDataTransferJobPause() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobPause.json + // this example is just showing the usage of "DataTransferJobs_Pause" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataTransferJobGetResultResource created on azure + // for more information of creating DataTransferJobGetResultResource, please refer to the document of DataTransferJobGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string jobName = "j1"; + ResourceIdentifier dataTransferJobGetResultResourceId = DataTransferJobGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, jobName); + DataTransferJobGetResultResource dataTransferJobGetResult = client.GetDataTransferJobGetResultResource(dataTransferJobGetResultResourceId); + + // invoke the operation + DataTransferJobGetResultResource result = await dataTransferJobGetResult.PauseAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Resume_CosmosDBDataTransferJobCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobResume.json + // this example is just showing the usage of "DataTransferJobs_Resume" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataTransferJobGetResultResource created on azure + // for more information of creating DataTransferJobGetResultResource, please refer to the document of DataTransferJobGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string jobName = "j1"; + ResourceIdentifier dataTransferJobGetResultResourceId = DataTransferJobGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, jobName); + DataTransferJobGetResultResource dataTransferJobGetResult = client.GetDataTransferJobGetResultResource(dataTransferJobGetResultResourceId); + + // invoke the operation + DataTransferJobGetResultResource result = await dataTransferJobGetResult.ResumeAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Cancel_CosmosDBDataTransferJobCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobCancel.json + // this example is just showing the usage of "DataTransferJobs_Cancel" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataTransferJobGetResultResource created on azure + // for more information of creating DataTransferJobGetResultResource, please refer to the document of DataTransferJobGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string jobName = "j1"; + ResourceIdentifier dataTransferJobGetResultResourceId = DataTransferJobGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, jobName); + DataTransferJobGetResultResource dataTransferJobGetResult = client.GetDataTransferJobGetResultResource(dataTransferJobGetResultResourceId); + + // invoke the operation + DataTransferJobGetResultResource result = await dataTransferJobGetResult.CancelAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultCollection.cs new file mode 100644 index 0000000000000..6dff44330db69 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultCollection.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GraphResourceGetResultCollection + { + // CosmosDBSqlDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceList.json + // this example is just showing the usage of "GraphResources_ListGraphs" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GraphResourceGetResultResource + GraphResourceGetResultCollection collection = cosmosDBAccount.GetGraphResourceGetResults(); + + // invoke the operation and iterate over the result + await foreach (GraphResourceGetResultResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceGet.json + // this example is just showing the usage of "GraphResources_GetGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GraphResourceGetResultResource + GraphResourceGetResultCollection collection = cosmosDBAccount.GetGraphResourceGetResults(); + + // invoke the operation + string graphName = "graphName"; + GraphResourceGetResultResource result = await collection.GetAsync(graphName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceGet.json + // this example is just showing the usage of "GraphResources_GetGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GraphResourceGetResultResource + GraphResourceGetResultCollection collection = cosmosDBAccount.GetGraphResourceGetResults(); + + // invoke the operation + string graphName = "graphName"; + bool result = await collection.ExistsAsync(graphName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceGet.json + // this example is just showing the usage of "GraphResources_GetGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GraphResourceGetResultResource + GraphResourceGetResultCollection collection = cosmosDBAccount.GetGraphResourceGetResults(); + + // invoke the operation + string graphName = "graphName"; + NullableResponse response = await collection.GetIfExistsAsync(graphName); + GraphResourceGetResultResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBGraphCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBGraphCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceCreateUpdate.json + // this example is just showing the usage of "GraphResources_CreateUpdateGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GraphResourceGetResultResource + GraphResourceGetResultCollection collection = cosmosDBAccount.GetGraphResourceGetResults(); + + // invoke the operation + string graphName = "graphName"; + GraphResourceGetResultCreateOrUpdateContent content = new GraphResourceGetResultCreateOrUpdateContent(new AzureLocation("West US"), new WritableSubResource() + { + Id = new ResourceIdentifier("graphName"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, graphName, content); + GraphResourceGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultResource.cs new file mode 100644 index 0000000000000..558547d126c1e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultResource.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GraphResourceGetResultResource + { + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceGet.json + // this example is just showing the usage of "GraphResources_GetGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GraphResourceGetResultResource created on azure + // for more information of creating GraphResourceGetResultResource, please refer to the document of GraphResourceGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string graphName = "graphName"; + ResourceIdentifier graphResourceGetResultResourceId = GraphResourceGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, graphName); + GraphResourceGetResultResource graphResourceGetResult = client.GetGraphResourceGetResultResource(graphResourceGetResultResourceId); + + // invoke the operation + GraphResourceGetResultResource result = await graphResourceGetResult.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGraphCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBGraphCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceCreateUpdate.json + // this example is just showing the usage of "GraphResources_CreateUpdateGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GraphResourceGetResultResource created on azure + // for more information of creating GraphResourceGetResultResource, please refer to the document of GraphResourceGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string graphName = "graphName"; + ResourceIdentifier graphResourceGetResultResourceId = GraphResourceGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, graphName); + GraphResourceGetResultResource graphResourceGetResult = client.GetGraphResourceGetResultResource(graphResourceGetResultResourceId); + + // invoke the operation + GraphResourceGetResultCreateOrUpdateContent content = new GraphResourceGetResultCreateOrUpdateContent(new AzureLocation("West US"), new WritableSubResource() + { + Id = new ResourceIdentifier("graphName"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await graphResourceGetResult.UpdateAsync(WaitUntil.Completed, content); + GraphResourceGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlDatabaseDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceDelete.json + // this example is just showing the usage of "GraphResources_DeleteGraphResource" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GraphResourceGetResultResource created on azure + // for more information of creating GraphResourceGetResultResource, please refer to the document of GraphResourceGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string graphName = "graphName"; + ResourceIdentifier graphResourceGetResultResourceId = GraphResourceGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, graphName); + GraphResourceGetResultResource graphResourceGetResult = client.GetGraphResourceGetResultResource(graphResourceGetResultResourceId); + + // invoke the operation + await graphResourceGetResult.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseCollection.cs new file mode 100644 index 0000000000000..6ae9c896bdf9a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseCollection.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinDatabaseCollection + { + // CosmosDBGremlinDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBGremlinDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseList.json + // this example is just showing the usage of "GremlinResources_ListGremlinDatabases" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GremlinDatabaseResource + GremlinDatabaseCollection collection = cosmosDBAccount.GetGremlinDatabases(); + + // invoke the operation and iterate over the result + await foreach (GremlinDatabaseResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBGremlinDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GremlinDatabaseResource + GremlinDatabaseCollection collection = cosmosDBAccount.GetGremlinDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + GremlinDatabaseResource result = await collection.GetAsync(databaseName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBGremlinDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GremlinDatabaseResource + GremlinDatabaseCollection collection = cosmosDBAccount.GetGremlinDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + bool result = await collection.ExistsAsync(databaseName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBGremlinDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBGremlinDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GremlinDatabaseResource + GremlinDatabaseCollection collection = cosmosDBAccount.GetGremlinDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + GremlinDatabaseResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBGremlinDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBGremlinDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseCreateUpdate.json + // this example is just showing the usage of "GremlinResources_CreateUpdateGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GremlinDatabaseResource + GremlinDatabaseCollection collection = cosmosDBAccount.GetGremlinDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + GremlinDatabaseCreateOrUpdateContent content = new GremlinDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new GremlinDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, content); + GremlinDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseResource.cs new file mode 100644 index 0000000000000..59aae237814c6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseResource.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinDatabaseResource + { + // CosmosDBGremlinDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // invoke the operation + GremlinDatabaseResource result = await gremlinDatabase.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBGremlinDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseCreateUpdate.json + // this example is just showing the usage of "GremlinResources_CreateUpdateGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // invoke the operation + GremlinDatabaseCreateOrUpdateContent content = new GremlinDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new GremlinDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await gremlinDatabase.UpdateAsync(WaitUntil.Completed, content); + GremlinDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBGremlinDatabaseDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseDelete.json + // this example is just showing the usage of "GremlinResources_DeleteGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // invoke the operation + await gremlinDatabase.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseThroughputSettingResource.cs new file mode 100644 index 0000000000000..bc18a43c6bb6d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseThroughputSettingResource.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinDatabaseThroughputSettingResource + { + // CosmosDBGremlinDatabaseThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinDatabaseThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseThroughputGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseThroughputSettingResource created on azure + // for more information of creating GremlinDatabaseThroughputSettingResource, please refer to the document of GremlinDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseThroughputSettingResourceId = GremlinDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseThroughputSettingResource gremlinDatabaseThroughputSetting = client.GetGremlinDatabaseThroughputSettingResource(gremlinDatabaseThroughputSettingResourceId); + + // invoke the operation + GremlinDatabaseThroughputSettingResource result = await gremlinDatabaseThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBGremlinDatabaseThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseThroughputUpdate.json + // this example is just showing the usage of "GremlinResources_UpdateGremlinDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseThroughputSettingResource created on azure + // for more information of creating GremlinDatabaseThroughputSettingResource, please refer to the document of GremlinDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseThroughputSettingResourceId = GremlinDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseThroughputSettingResource gremlinDatabaseThroughputSetting = client.GetGremlinDatabaseThroughputSettingResource(gremlinDatabaseThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await gremlinDatabaseThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + GremlinDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateGremlinDatabaseToAutoscale_CosmosDBGremlinDatabaseMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseMigrateToAutoscale.json + // this example is just showing the usage of "GremlinResources_MigrateGremlinDatabaseToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseThroughputSettingResource created on azure + // for more information of creating GremlinDatabaseThroughputSettingResource, please refer to the document of GremlinDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseThroughputSettingResourceId = GremlinDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseThroughputSettingResource gremlinDatabaseThroughputSetting = client.GetGremlinDatabaseThroughputSettingResource(gremlinDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await gremlinDatabaseThroughputSetting.MigrateGremlinDatabaseToAutoscaleAsync(WaitUntil.Completed); + GremlinDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateGremlinDatabaseToManualThroughput_CosmosDBGremlinDatabaseMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseMigrateToManualThroughput.json + // this example is just showing the usage of "GremlinResources_MigrateGremlinDatabaseToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseThroughputSettingResource created on azure + // for more information of creating GremlinDatabaseThroughputSettingResource, please refer to the document of GremlinDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseThroughputSettingResourceId = GremlinDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseThroughputSettingResource gremlinDatabaseThroughputSetting = client.GetGremlinDatabaseThroughputSettingResource(gremlinDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await gremlinDatabaseThroughputSetting.MigrateGremlinDatabaseToManualThroughputAsync(WaitUntil.Completed); + GremlinDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphCollection.cs new file mode 100644 index 0000000000000..4ba1d2ad7ab43 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphCollection.cs @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinGraphCollection + { + // CosmosDBGremlinGraphList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBGremlinGraphList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphList.json + // this example is just showing the usage of "GremlinResources_ListGremlinGraphs" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // get the collection of this GremlinGraphResource + GremlinGraphCollection collection = gremlinDatabase.GetGremlinGraphs(); + + // invoke the operation and iterate over the result + await foreach (GremlinGraphResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBGremlinGraphGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinGraphGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // get the collection of this GremlinGraphResource + GremlinGraphCollection collection = gremlinDatabase.GetGremlinGraphs(); + + // invoke the operation + string graphName = "graphName"; + GremlinGraphResource result = await collection.GetAsync(graphName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBGremlinGraphGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // get the collection of this GremlinGraphResource + GremlinGraphCollection collection = gremlinDatabase.GetGremlinGraphs(); + + // invoke the operation + string graphName = "graphName"; + bool result = await collection.ExistsAsync(graphName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBGremlinGraphGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBGremlinGraphGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // get the collection of this GremlinGraphResource + GremlinGraphCollection collection = gremlinDatabase.GetGremlinGraphs(); + + // invoke the operation + string graphName = "graphName"; + NullableResponse response = await collection.GetIfExistsAsync(graphName); + GremlinGraphResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBGremlinGraphCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBGremlinGraphCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphCreateUpdate.json + // this example is just showing the usage of "GremlinResources_CreateUpdateGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // get the collection of this GremlinGraphResource + GremlinGraphCollection collection = gremlinDatabase.GetGremlinGraphs(); + + // invoke the operation + string graphName = "graphName"; + GremlinGraphCreateOrUpdateContent content = new GremlinGraphCreateOrUpdateContent(new AzureLocation("West US"), new GremlinGraphResourceInfo("graphName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/AccountNumber" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + DefaultTtl = 100, + UniqueKeys = +{ +new CosmosDBUniqueKey() +{ +Paths = +{ +"/testPath" +}, +} +}, + ConflictResolutionPolicy = new ConflictResolutionPolicy() + { + Mode = ConflictResolutionMode.LastWriterWins, + ConflictResolutionPath = "/path", + }, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, graphName, content); + GremlinGraphResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphResource.cs new file mode 100644 index 0000000000000..115044f71cf11 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphResource.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinGraphResource + { + // CosmosDBGremlinGraphGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinGraphGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphResource created on azure + // for more information of creating GremlinGraphResource, please refer to the document of GremlinGraphResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphResourceId = GremlinGraphResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphResource gremlinGraph = client.GetGremlinGraphResource(gremlinGraphResourceId); + + // invoke the operation + GremlinGraphResource result = await gremlinGraph.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBGremlinGraphCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphCreateUpdate.json + // this example is just showing the usage of "GremlinResources_CreateUpdateGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphResource created on azure + // for more information of creating GremlinGraphResource, please refer to the document of GremlinGraphResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphResourceId = GremlinGraphResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphResource gremlinGraph = client.GetGremlinGraphResource(gremlinGraphResourceId); + + // invoke the operation + GremlinGraphCreateOrUpdateContent content = new GremlinGraphCreateOrUpdateContent(new AzureLocation("West US"), new GremlinGraphResourceInfo("graphName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/AccountNumber" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + DefaultTtl = 100, + UniqueKeys = +{ +new CosmosDBUniqueKey() +{ +Paths = +{ +"/testPath" +}, +} +}, + ConflictResolutionPolicy = new ConflictResolutionPolicy() + { + Mode = ConflictResolutionMode.LastWriterWins, + ConflictResolutionPath = "/path", + }, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await gremlinGraph.UpdateAsync(WaitUntil.Completed, content); + GremlinGraphResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBGremlinGraphDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphDelete.json + // this example is just showing the usage of "GremlinResources_DeleteGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphResource created on azure + // for more information of creating GremlinGraphResource, please refer to the document of GremlinGraphResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphResourceId = GremlinGraphResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphResource gremlinGraph = client.GetGremlinGraphResource(gremlinGraphResourceId); + + // invoke the operation + await gremlinGraph.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBGremlinGraphBackupInformation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RetrieveContinuousBackupInformation_CosmosDBGremlinGraphBackupInformation() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphBackupInformation.json + // this example is just showing the usage of "GremlinResources_RetrieveContinuousBackupInformation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphResource created on azure + // for more information of creating GremlinGraphResource, please refer to the document of GremlinGraphResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphResourceId = GremlinGraphResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphResource gremlinGraph = client.GetGremlinGraphResource(gremlinGraphResourceId); + + // invoke the operation + ContinuousBackupRestoreLocation location = new ContinuousBackupRestoreLocation() + { + Location = new AzureLocation("North Europe"), + }; + ArmOperation lro = await gremlinGraph.RetrieveContinuousBackupInformationAsync(WaitUntil.Completed, location); + CosmosDBBackupInformation result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphThroughputSettingResource.cs new file mode 100644 index 0000000000000..e7626c835fa0c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphThroughputSettingResource.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinGraphThroughputSettingResource + { + // CosmosDBGremlinGraphThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinGraphThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphThroughputGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinGraphThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphThroughputSettingResource created on azure + // for more information of creating GremlinGraphThroughputSettingResource, please refer to the document of GremlinGraphThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphThroughputSettingResourceId = GremlinGraphThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphThroughputSettingResource gremlinGraphThroughputSetting = client.GetGremlinGraphThroughputSettingResource(gremlinGraphThroughputSettingResourceId); + + // invoke the operation + GremlinGraphThroughputSettingResource result = await gremlinGraphThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBGremlinGraphThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphThroughputUpdate.json + // this example is just showing the usage of "GremlinResources_UpdateGremlinGraphThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphThroughputSettingResource created on azure + // for more information of creating GremlinGraphThroughputSettingResource, please refer to the document of GremlinGraphThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphThroughputSettingResourceId = GremlinGraphThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphThroughputSettingResource gremlinGraphThroughputSetting = client.GetGremlinGraphThroughputSettingResource(gremlinGraphThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await gremlinGraphThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + GremlinGraphThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateGremlinGraphToAutoscale_CosmosDBGremlinGraphMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphMigrateToAutoscale.json + // this example is just showing the usage of "GremlinResources_MigrateGremlinGraphToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphThroughputSettingResource created on azure + // for more information of creating GremlinGraphThroughputSettingResource, please refer to the document of GremlinGraphThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphThroughputSettingResourceId = GremlinGraphThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphThroughputSettingResource gremlinGraphThroughputSetting = client.GetGremlinGraphThroughputSettingResource(gremlinGraphThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await gremlinGraphThroughputSetting.MigrateGremlinGraphToAutoscaleAsync(WaitUntil.Completed); + GremlinGraphThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateGremlinGraphToManualThroughput_CosmosDBGremlinGraphMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphMigrateToManualThroughput.json + // this example is just showing the usage of "GremlinResources_MigrateGremlinGraphToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphThroughputSettingResource created on azure + // for more information of creating GremlinGraphThroughputSettingResource, please refer to the document of GremlinGraphThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphThroughputSettingResourceId = GremlinGraphThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphThroughputSettingResource gremlinGraphThroughputSetting = client.GetGremlinGraphThroughputSettingResource(gremlinGraphThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await gremlinGraphThroughputSetting.MigrateGremlinGraphToManualThroughputAsync(WaitUntil.Completed); + GremlinGraphThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterCollection.cs new file mode 100644 index 0000000000000..3f55ffc7f1307 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterCollection.cs @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoClusterCollection + { + // List the mongo clusters by resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListTheMongoClustersByResourceGroup() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterListByResourceGroup.json + // this example is just showing the usage of "MongoClusters_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation and iterate over the result + await foreach (MongoClusterResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create a new mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateANewMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterCreate.json + // this example is just showing the usage of "MongoClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation + string mongoClusterName = "myMongoCluster"; + MongoClusterData data = new MongoClusterData(new AzureLocation("westus2")) + { + AdministratorLogin = "mongoAdmin", + AdministratorLoginPassword = "password", + ServerVersion = "5.0", + NodeGroupSpecs = +{ +new NodeGroupSpec() +{ +Kind = NodeKind.Shard, +NodeCount = 3, +Sku = "M30", +DiskSizeInGB = 128, +EnableHa = true, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, mongoClusterName, data); + MongoClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create a new mongo cluster with point in time restore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateANewMongoClusterWithPointInTimeRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterCreatePITR.json + // this example is just showing the usage of "MongoClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation + string mongoClusterName = "myMongoCluster"; + MongoClusterData data = new MongoClusterData(new AzureLocation("westus2")) + { + CreateMode = CosmosDBAccountCreateMode.PointInTimeRestore, + RestoreParameters = new MongoClusterRestoreParameters() + { + PointInTimeUTC = DateTimeOffset.Parse("2023-01-13T20:07:35Z"), + SourceResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, mongoClusterName, data); + MongoClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterGet.json + // this example is just showing the usage of "MongoClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation + string mongoClusterName = "myMongoCluster"; + MongoClusterResource result = await collection.GetAsync(mongoClusterName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterGet.json + // this example is just showing the usage of "MongoClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation + string mongoClusterName = "myMongoCluster"; + bool result = await collection.ExistsAsync(mongoClusterName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterGet.json + // this example is just showing the usage of "MongoClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation + string mongoClusterName = "myMongoCluster"; + NullableResponse response = await collection.GetIfExistsAsync(mongoClusterName); + MongoClusterResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterResource.cs new file mode 100644 index 0000000000000..50ebe03ff724c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterResource.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoClusterResource + { + // List all the mongo clusters + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMongoClusters_ListAllTheMongoClusters() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterList.json + // this example is just showing the usage of "MongoClusters_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (MongoClusterResource item in subscriptionResource.GetMongoClustersAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterGet.json + // this example is just showing the usage of "MongoClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + MongoClusterResource result = await mongoCluster.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterDelete.json + // this example is just showing the usage of "MongoClusters_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + await mongoCluster.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Add new shard nodes + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_AddNewShardNodes() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterAddNode.json + // this example is just showing the usage of "MongoClusters_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + MongoClusterPatch patch = new MongoClusterPatch() + { + NodeGroupSpecs = +{ +new NodeGroupSpec() +{ +Kind = NodeKind.Shard, +NodeCount = 4, +} +}, + }; + ArmOperation lro = await mongoCluster.UpdateAsync(WaitUntil.Completed, patch); + MongoClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterUpdate.json + // this example is just showing the usage of "MongoClusters_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + MongoClusterPatch patch = new MongoClusterPatch() + { + AdministratorLogin = "mongoAdmin", + AdministratorLoginPassword = "password", + ServerVersion = "5.0", + NodeGroupSpecs = +{ +new NodeGroupSpec() +{ +Kind = NodeKind.Shard, +NodeCount = 4, +Sku = "M50", +DiskSizeInGB = 256, +EnableHa = true, +} +}, + }; + ArmOperation lro = await mongoCluster.UpdateAsync(WaitUntil.Completed, patch); + MongoClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get connection string + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetConnectionStrings_GetConnectionString() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterListConnectionStrings.json + // this example is just showing the usage of "MongoClusters_ListConnectionStrings" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + ListConnectionStringsResult result = await mongoCluster.GetConnectionStringsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionCollection.cs new file mode 100644 index 0000000000000..b51b5ac83ed26 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionCollection.cs @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBCollectionCollection + { + // CosmosDBMongoDBCollectionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBMongoDBCollectionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionList.json + // this example is just showing the usage of "MongoDBResources_ListMongoDBCollections" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation and iterate over the result + await foreach (MongoDBCollectionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBMongoDBCollectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBCollectionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation + string collectionName = "collectionName"; + MongoDBCollectionResource result = await collection.GetAsync(collectionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBMongoDBCollectionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation + string collectionName = "collectionName"; + bool result = await collection.ExistsAsync(collectionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBCollectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBMongoDBCollectionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation + string collectionName = "collectionName"; + NullableResponse response = await collection.GetIfExistsAsync(collectionName); + MongoDBCollectionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBMongoDBCollectionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBCollectionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation + string collectionName = "collectionName"; + MongoDBCollectionCreateOrUpdateContent content = new MongoDBCollectionCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBCollectionResourceInfo("collectionName") + { + ShardKey = +{ +["testKey"] = "Hash", +}, + Indexes = +{ +new MongoDBIndex() +{ +Keys = +{ +"_ts" +}, +Options = new MongoDBIndexConfig() +{ +ExpireAfterSeconds = 100, +IsUnique = true, +}, +},new MongoDBIndex() +{ +Keys = +{ +"_id" +}, +} +}, + AnalyticalStorageTtl = 500, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, collectionName, content); + MongoDBCollectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBCollectionRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionRestore.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation + string collectionName = "collectionName"; + MongoDBCollectionCreateOrUpdateContent content = new MongoDBCollectionCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBCollectionResourceInfo("collectionName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, collectionName, content); + MongoDBCollectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionResource.cs new file mode 100644 index 0000000000000..162fb065cb7f3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionResource.cs @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBCollectionResource + { + // CosmosDBMongoDBCollectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBCollectionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + MongoDBCollectionResource result = await mongoDBCollection.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBCollectionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + MongoDBCollectionCreateOrUpdateContent content = new MongoDBCollectionCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBCollectionResourceInfo("collectionName") + { + ShardKey = +{ +["testKey"] = "Hash", +}, + Indexes = +{ +new MongoDBIndex() +{ +Keys = +{ +"_ts" +}, +Options = new MongoDBIndexConfig() +{ +ExpireAfterSeconds = 100, +IsUnique = true, +}, +},new MongoDBIndex() +{ +Keys = +{ +"_id" +}, +} +}, + AnalyticalStorageTtl = 500, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBCollection.UpdateAsync(WaitUntil.Completed, content); + MongoDBCollectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBCollectionRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionRestore.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + MongoDBCollectionCreateOrUpdateContent content = new MongoDBCollectionCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBCollectionResourceInfo("collectionName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBCollection.UpdateAsync(WaitUntil.Completed, content); + MongoDBCollectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBMongoDBCollectionDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionDelete.json + // this example is just showing the usage of "MongoDBResources_DeleteMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + await mongoDBCollection.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBMongoDBCollectionPartitionMerge + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMongoDBCollectionPartitionMerge_CosmosDBMongoDBCollectionPartitionMerge() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionPartitionMerge.json + // this example is just showing the usage of "MongoDBResources_ListMongoDBCollectionPartitionMerge" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + MergeParameters mergeParameters = new MergeParameters() + { + IsDryRun = false, + }; + ArmOperation lro = await mongoDBCollection.GetMongoDBCollectionPartitionMergeAsync(WaitUntil.Completed, mergeParameters); + PhysicalPartitionStorageInfoCollection result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBCollectionBackupInformation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RetrieveContinuousBackupInformation_CosmosDBMongoDBCollectionBackupInformation() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionBackupInformation.json + // this example is just showing the usage of "MongoDBResources_RetrieveContinuousBackupInformation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + ContinuousBackupRestoreLocation location = new ContinuousBackupRestoreLocation() + { + Location = new AzureLocation("North Europe"), + }; + ArmOperation lro = await mongoDBCollection.RetrieveContinuousBackupInformationAsync(WaitUntil.Completed, location); + CosmosDBBackupInformation result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionThroughputSettingResource.cs new file mode 100644 index 0000000000000..a7112954dc775 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionThroughputSettingResource.cs @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBCollectionThroughputSettingResource + { + // CosmosDBMongoDBCollectionRetrieveThroughputDistribution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MongoDBContainerRetrieveThroughputDistribution_CosmosDBMongoDBCollectionRetrieveThroughputDistribution() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionRetrieveThroughputDistribution.json + // this example is just showing the usage of "MongoDBResources_MongoDBContainerRetrieveThroughputDistribution" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + RetrieveThroughputParameters retrieveThroughputParameters = new RetrieveThroughputParameters(new AzureLocation("placeholder"), new RetrieveThroughputPropertiesResource(new WritableSubResource[] + { +new WritableSubResource() +{ +Id = new ResourceIdentifier("0"), +},new WritableSubResource() +{ +Id = new ResourceIdentifier("1"), +} + })); + ArmOperation lro = await mongoDBCollectionThroughputSetting.MongoDBContainerRetrieveThroughputDistributionAsync(WaitUntil.Completed, retrieveThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBCollectionRedistributeThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MongoDBContainerRedistributeThroughput_CosmosDBMongoDBCollectionRedistributeThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionRedistributeThroughput.json + // this example is just showing the usage of "MongoDBResources_MongoDBContainerRedistributeThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + RedistributeThroughputParameters redistributeThroughputParameters = new RedistributeThroughputParameters(new AzureLocation("placeholder"), new RedistributeThroughputPropertiesResource(ThroughputPolicyType.Custom, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("0") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("1") +{ +Throughput = 5000, +} + }, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("2") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("3") + })); + ArmOperation lro = await mongoDBCollectionThroughputSetting.MongoDBContainerRedistributeThroughputAsync(WaitUntil.Completed, redistributeThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBCollectionThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBCollectionThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionThroughputGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBCollectionThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + MongoDBCollectionThroughputSettingResource result = await mongoDBCollectionThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBCollectionThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionThroughputUpdate.json + // this example is just showing the usage of "MongoDBResources_UpdateMongoDBCollectionThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBCollectionThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + MongoDBCollectionThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateMongoDBCollectionToAutoscale_CosmosDBMongoDBCollectionMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionMigrateToAutoscale.json + // this example is just showing the usage of "MongoDBResources_MigrateMongoDBCollectionToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await mongoDBCollectionThroughputSetting.MigrateMongoDBCollectionToAutoscaleAsync(WaitUntil.Completed); + MongoDBCollectionThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateMongoDBCollectionToManualThroughput_CosmosDBMongoDBCollectionMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionMigrateToManualThroughput.json + // this example is just showing the usage of "MongoDBResources_MigrateMongoDBCollectionToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await mongoDBCollectionThroughputSetting.MigrateMongoDBCollectionToManualThroughputAsync(WaitUntil.Completed); + MongoDBCollectionThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseCollection.cs new file mode 100644 index 0000000000000..163489d935599 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseCollection.cs @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBDatabaseCollection + { + // CosmosDBMongoDBDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBMongoDBDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseList.json + // this example is just showing the usage of "MongoDBResources_ListMongoDBDatabases" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation and iterate over the result + await foreach (MongoDBDatabaseResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBMongoDBDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + MongoDBDatabaseResource result = await collection.GetAsync(databaseName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBMongoDBDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + bool result = await collection.ExistsAsync(databaseName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBMongoDBDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + MongoDBDatabaseResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBMongoDBDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + MongoDBDatabaseCreateOrUpdateContent content = new MongoDBDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, content); + MongoDBDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBDatabaseRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseRestore.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + MongoDBDatabaseCreateOrUpdateContent content = new MongoDBDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBDatabaseResourceInfo("databaseName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, content); + MongoDBDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseResource.cs new file mode 100644 index 0000000000000..c8b77beeb9285 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseResource.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBDatabaseResource + { + // CosmosDBMongoDBDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // invoke the operation + MongoDBDatabaseResource result = await mongoDBDatabase.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // invoke the operation + MongoDBDatabaseCreateOrUpdateContent content = new MongoDBDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBDatabase.UpdateAsync(WaitUntil.Completed, content); + MongoDBDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBDatabaseRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseRestore.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // invoke the operation + MongoDBDatabaseCreateOrUpdateContent content = new MongoDBDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBDatabaseResourceInfo("databaseName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBDatabase.UpdateAsync(WaitUntil.Completed, content); + MongoDBDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBMongoDBDatabaseDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseDelete.json + // this example is just showing the usage of "MongoDBResources_DeleteMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // invoke the operation + await mongoDBDatabase.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBMongoDBDatabasePartitionMerge + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MongoDBDatabasePartitionMerge_CosmosDBMongoDBDatabasePartitionMerge() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabasePartitionMerge.json + // this example is just showing the usage of "MongoDBResources_MongoDBDatabasePartitionMerge" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // invoke the operation + MergeParameters mergeParameters = new MergeParameters() + { + IsDryRun = false, + }; + ArmOperation lro = await mongoDBDatabase.MongoDBDatabasePartitionMergeAsync(WaitUntil.Completed, mergeParameters); + PhysicalPartitionStorageInfoCollection result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseThroughputSettingResource.cs new file mode 100644 index 0000000000000..a5480cf2cced7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseThroughputSettingResource.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBDatabaseThroughputSettingResource + { + // CosmosDBMongoDBDatabaseThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBDatabaseThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseThroughputGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + MongoDBDatabaseThroughputSettingResource result = await mongoDBDatabaseThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBDatabaseThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseThroughputUpdate.json + // this example is just showing the usage of "MongoDBResources_UpdateMongoDBDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBDatabaseThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + MongoDBDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateMongoDBDatabaseToAutoscale_CosmosDBMongoDBDatabaseMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseMigrateToAutoscale.json + // this example is just showing the usage of "MongoDBResources_MigrateMongoDBDatabaseToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await mongoDBDatabaseThroughputSetting.MigrateMongoDBDatabaseToAutoscaleAsync(WaitUntil.Completed); + MongoDBDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateMongoDBDatabaseToManualThroughput_CosmosDBMongoDBDatabaseMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseMigrateToManualThroughput.json + // this example is just showing the usage of "MongoDBResources_MigrateMongoDBDatabaseToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await mongoDBDatabaseThroughputSetting.MigrateMongoDBDatabaseToManualThroughputAsync(WaitUntil.Completed); + MongoDBDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseRetrieveThroughputDistribution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MongoDBDatabaseRetrieveThroughputDistribution_CosmosDBMongoDBDatabaseRetrieveThroughputDistribution() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseRetrieveThroughputDistribution.json + // this example is just showing the usage of "MongoDBResources_MongoDBDatabaseRetrieveThroughputDistribution" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + RetrieveThroughputParameters retrieveThroughputParameters = new RetrieveThroughputParameters(new AzureLocation("placeholder"), new RetrieveThroughputPropertiesResource(new WritableSubResource[] + { +new WritableSubResource() +{ +Id = new ResourceIdentifier("0"), +},new WritableSubResource() +{ +Id = new ResourceIdentifier("1"), +} + })); + ArmOperation lro = await mongoDBDatabaseThroughputSetting.MongoDBDatabaseRetrieveThroughputDistributionAsync(WaitUntil.Completed, retrieveThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBDatabaseRedistributeThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MongoDBDatabaseRedistributeThroughput_CosmosDBMongoDBDatabaseRedistributeThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseRedistributeThroughput.json + // this example is just showing the usage of "MongoDBResources_MongoDBDatabaseRedistributeThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + RedistributeThroughputParameters redistributeThroughputParameters = new RedistributeThroughputParameters(new AzureLocation("placeholder"), new RedistributeThroughputPropertiesResource(ThroughputPolicyType.Custom, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("0") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("1") +{ +Throughput = 5000, +} + }, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("2") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("3") + })); + ArmOperation lro = await mongoDBDatabaseThroughputSetting.MongoDBDatabaseRedistributeThroughputAsync(WaitUntil.Completed, redistributeThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionCollection.cs new file mode 100644 index 0000000000000..2242761487f6f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionCollection.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBRoleDefinitionCollection + { + // CosmosDBMongoRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBRoleDefinitionResource + MongoDBRoleDefinitionCollection collection = cosmosDBAccount.GetMongoDBRoleDefinitions(); + + // invoke the operation + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + MongoDBRoleDefinitionResource result = await collection.GetAsync(mongoRoleDefinitionId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBMongoRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBRoleDefinitionResource + MongoDBRoleDefinitionCollection collection = cosmosDBAccount.GetMongoDBRoleDefinitions(); + + // invoke the operation + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + bool result = await collection.ExistsAsync(mongoRoleDefinitionId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBMongoRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBRoleDefinitionResource + MongoDBRoleDefinitionCollection collection = cosmosDBAccount.GetMongoDBRoleDefinitions(); + + // invoke the operation + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + NullableResponse response = await collection.GetIfExistsAsync(mongoRoleDefinitionId); + MongoDBRoleDefinitionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBMongoDBRoleDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBRoleDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBRoleDefinitionResource + MongoDBRoleDefinitionCollection collection = cosmosDBAccount.GetMongoDBRoleDefinitions(); + + // invoke the operation + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + MongoDBRoleDefinitionCreateOrUpdateContent content = new MongoDBRoleDefinitionCreateOrUpdateContent() + { + RoleName = "myRoleName", + DatabaseName = "sales", + Privileges = +{ +new MongoDBPrivilege() +{ +Resource = new MongoDBPrivilegeResourceInfo() +{ +DBName = "sales", +Collection = "sales", +}, +Actions = +{ +"insert","find" +}, +} +}, + Roles = +{ +new MongoDBRole() +{ +DBName = "sales", +Role = "myInheritedRole", +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, mongoRoleDefinitionId, content); + MongoDBRoleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBRoleDefinitionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBMongoDBRoleDefinitionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionList.json + // this example is just showing the usage of "MongoDBResources_ListMongoRoleDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBRoleDefinitionResource + MongoDBRoleDefinitionCollection collection = cosmosDBAccount.GetMongoDBRoleDefinitions(); + + // invoke the operation and iterate over the result + await foreach (MongoDBRoleDefinitionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionResource.cs new file mode 100644 index 0000000000000..cec383811e36a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionResource.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBRoleDefinitionResource + { + // CosmosDBMongoRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBRoleDefinitionResource created on azure + // for more information of creating MongoDBRoleDefinitionResource, please refer to the document of MongoDBRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + ResourceIdentifier mongoDBRoleDefinitionResourceId = MongoDBRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoRoleDefinitionId); + MongoDBRoleDefinitionResource mongoDBRoleDefinition = client.GetMongoDBRoleDefinitionResource(mongoDBRoleDefinitionResourceId); + + // invoke the operation + MongoDBRoleDefinitionResource result = await mongoDBRoleDefinition.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBRoleDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBRoleDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBRoleDefinitionResource created on azure + // for more information of creating MongoDBRoleDefinitionResource, please refer to the document of MongoDBRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + ResourceIdentifier mongoDBRoleDefinitionResourceId = MongoDBRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoRoleDefinitionId); + MongoDBRoleDefinitionResource mongoDBRoleDefinition = client.GetMongoDBRoleDefinitionResource(mongoDBRoleDefinitionResourceId); + + // invoke the operation + MongoDBRoleDefinitionCreateOrUpdateContent content = new MongoDBRoleDefinitionCreateOrUpdateContent() + { + RoleName = "myRoleName", + DatabaseName = "sales", + Privileges = +{ +new MongoDBPrivilege() +{ +Resource = new MongoDBPrivilegeResourceInfo() +{ +DBName = "sales", +Collection = "sales", +}, +Actions = +{ +"insert","find" +}, +} +}, + Roles = +{ +new MongoDBRole() +{ +DBName = "sales", +Role = "myInheritedRole", +} +}, + }; + ArmOperation lro = await mongoDBRoleDefinition.UpdateAsync(WaitUntil.Completed, content); + MongoDBRoleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBRoleDefinitionDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBMongoDBRoleDefinitionDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionDelete.json + // this example is just showing the usage of "MongoDBResources_DeleteMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBRoleDefinitionResource created on azure + // for more information of creating MongoDBRoleDefinitionResource, please refer to the document of MongoDBRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + ResourceIdentifier mongoDBRoleDefinitionResourceId = MongoDBRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoRoleDefinitionId); + MongoDBRoleDefinitionResource mongoDBRoleDefinition = client.GetMongoDBRoleDefinitionResource(mongoDBRoleDefinitionResourceId); + + // invoke the operation + await mongoDBRoleDefinition.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionCollection.cs new file mode 100644 index 0000000000000..9fff97556e4d9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionCollection.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBUserDefinitionCollection + { + // CosmosDBMongoDBUserDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBUserDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBUserDefinitionResource + MongoDBUserDefinitionCollection collection = cosmosDBAccount.GetMongoDBUserDefinitions(); + + // invoke the operation + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + MongoDBUserDefinitionResource result = await collection.GetAsync(mongoUserDefinitionId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBUserDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBMongoDBUserDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBUserDefinitionResource + MongoDBUserDefinitionCollection collection = cosmosDBAccount.GetMongoDBUserDefinitions(); + + // invoke the operation + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + bool result = await collection.ExistsAsync(mongoUserDefinitionId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBUserDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBMongoDBUserDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBUserDefinitionResource + MongoDBUserDefinitionCollection collection = cosmosDBAccount.GetMongoDBUserDefinitions(); + + // invoke the operation + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + NullableResponse response = await collection.GetIfExistsAsync(mongoUserDefinitionId); + MongoDBUserDefinitionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBMongoDBUserDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBUserDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBUserDefinitionResource + MongoDBUserDefinitionCollection collection = cosmosDBAccount.GetMongoDBUserDefinitions(); + + // invoke the operation + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + MongoDBUserDefinitionCreateOrUpdateContent content = new MongoDBUserDefinitionCreateOrUpdateContent() + { + UserName = "myUserName", + Password = "myPassword", + DatabaseName = "sales", + CustomData = "My custom data", + Roles = +{ +new MongoDBRole() +{ +DBName = "sales", +Role = "myReadRole", +} +}, + Mechanisms = "SCRAM-SHA-256", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, mongoUserDefinitionId, content); + MongoDBUserDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBUserDefinitionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBMongoDBUserDefinitionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionList.json + // this example is just showing the usage of "MongoDBResources_ListMongoUserDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBUserDefinitionResource + MongoDBUserDefinitionCollection collection = cosmosDBAccount.GetMongoDBUserDefinitions(); + + // invoke the operation and iterate over the result + await foreach (MongoDBUserDefinitionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionResource.cs new file mode 100644 index 0000000000000..c08d54acb8986 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionResource.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBUserDefinitionResource + { + // CosmosDBMongoDBUserDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBUserDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBUserDefinitionResource created on azure + // for more information of creating MongoDBUserDefinitionResource, please refer to the document of MongoDBUserDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + ResourceIdentifier mongoDBUserDefinitionResourceId = MongoDBUserDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoUserDefinitionId); + MongoDBUserDefinitionResource mongoDBUserDefinition = client.GetMongoDBUserDefinitionResource(mongoDBUserDefinitionResourceId); + + // invoke the operation + MongoDBUserDefinitionResource result = await mongoDBUserDefinition.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBUserDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBUserDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBUserDefinitionResource created on azure + // for more information of creating MongoDBUserDefinitionResource, please refer to the document of MongoDBUserDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + ResourceIdentifier mongoDBUserDefinitionResourceId = MongoDBUserDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoUserDefinitionId); + MongoDBUserDefinitionResource mongoDBUserDefinition = client.GetMongoDBUserDefinitionResource(mongoDBUserDefinitionResourceId); + + // invoke the operation + MongoDBUserDefinitionCreateOrUpdateContent content = new MongoDBUserDefinitionCreateOrUpdateContent() + { + UserName = "myUserName", + Password = "myPassword", + DatabaseName = "sales", + CustomData = "My custom data", + Roles = +{ +new MongoDBRole() +{ +DBName = "sales", +Role = "myReadRole", +} +}, + Mechanisms = "SCRAM-SHA-256", + }; + ArmOperation lro = await mongoDBUserDefinition.UpdateAsync(WaitUntil.Completed, content); + MongoDBUserDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBUserDefinitionDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBMongoDBUserDefinitionDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionDelete.json + // this example is just showing the usage of "MongoDBResources_DeleteMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBUserDefinitionResource created on azure + // for more information of creating MongoDBUserDefinitionResource, please refer to the document of MongoDBUserDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + ResourceIdentifier mongoDBUserDefinitionResourceId = MongoDBUserDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoUserDefinitionId); + MongoDBUserDefinitionResource mongoDBUserDefinition = client.GetMongoDBUserDefinitionResource(mongoDBUserDefinitionResourceId); + + // invoke the operation + await mongoDBUserDefinition.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountCollection.cs new file mode 100644 index 0000000000000..001e754460501 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountCollection.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_RestorableCosmosDBAccountCollection + { + // CosmosDBRestorableDatabaseAccountList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBRestorableDatabaseAccountList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountList.json + // this example is just showing the usage of "RestorableDatabaseAccounts_ListByLocation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("West US"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // get the collection of this RestorableCosmosDBAccountResource + RestorableCosmosDBAccountCollection collection = cosmosDBLocation.GetRestorableCosmosDBAccounts(); + + // invoke the operation and iterate over the result + await foreach (RestorableCosmosDBAccountResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RestorableCosmosDBAccountData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBRestorableDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountGet.json + // this example is just showing the usage of "RestorableDatabaseAccounts_GetByLocation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("West US"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // get the collection of this RestorableCosmosDBAccountResource + RestorableCosmosDBAccountCollection collection = cosmosDBLocation.GetRestorableCosmosDBAccounts(); + + // invoke the operation + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + RestorableCosmosDBAccountResource result = await collection.GetAsync(instanceId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RestorableCosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBRestorableDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBRestorableDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountGet.json + // this example is just showing the usage of "RestorableDatabaseAccounts_GetByLocation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("West US"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // get the collection of this RestorableCosmosDBAccountResource + RestorableCosmosDBAccountCollection collection = cosmosDBLocation.GetRestorableCosmosDBAccounts(); + + // invoke the operation + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + bool result = await collection.ExistsAsync(instanceId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBRestorableDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBRestorableDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountGet.json + // this example is just showing the usage of "RestorableDatabaseAccounts_GetByLocation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("West US"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // get the collection of this RestorableCosmosDBAccountResource + RestorableCosmosDBAccountCollection collection = cosmosDBLocation.GetRestorableCosmosDBAccounts(); + + // invoke the operation + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + NullableResponse response = await collection.GetIfExistsAsync(instanceId); + RestorableCosmosDBAccountResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RestorableCosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountResource.cs new file mode 100644 index 0000000000000..278e8a0f2328f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountResource.cs @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_RestorableCosmosDBAccountResource + { + // CosmosDBRestorableDatabaseAccountNoLocationList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableCosmosDBAccounts_CosmosDBRestorableDatabaseAccountNoLocationList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json + // this example is just showing the usage of "RestorableDatabaseAccounts_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (RestorableCosmosDBAccountResource item in subscriptionResource.GetRestorableCosmosDBAccountsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RestorableCosmosDBAccountData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBRestorableDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountGet.json + // this example is just showing the usage of "RestorableDatabaseAccounts_GetByLocation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("West US"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation + RestorableCosmosDBAccountResource result = await restorableCosmosDBAccount.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RestorableCosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBRestorableSqlDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableSqlDatabases_CosmosDBRestorableSqlDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableSqlDatabaseList.json + // this example is just showing the usage of "RestorableSqlDatabases_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (RestorableSqlDatabase item in restorableCosmosDBAccount.GetRestorableSqlDatabasesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableSqlContainerList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableSqlContainers_CosmosDBRestorableSqlContainerList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableSqlContainerList.json + // this example is just showing the usage of "RestorableSqlContainers_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("98a570f2-63db-4117-91f0-366327b7b353"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string restorableSqlDatabaseRid = "3fu-hg=="; + await foreach (RestorableSqlContainer item in restorableCosmosDBAccount.GetRestorableSqlContainersAsync(restorableSqlDatabaseRid: restorableSqlDatabaseRid)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableSqlResourceList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAllRestorableSqlResourceData_CosmosDBRestorableSqlResourceList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableSqlResourceList.json + // this example is just showing the usage of "RestorableSqlResources_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + AzureLocation? restoreLocation = new AzureLocation("WestUS"); + string restoreTimestampInUtc = "06/01/2022 4:56"; + await foreach (RestorableSqlResourceData item in restorableCosmosDBAccount.GetAllRestorableSqlResourceDataAsync(restoreLocation: restoreLocation, restoreTimestampInUtc: restoreTimestampInUtc)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableMongodbDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableMongoDBDatabases_CosmosDBRestorableMongodbDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableMongodbDatabaseList.json + // this example is just showing the usage of "RestorableMongodbDatabases_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (RestorableMongoDBDatabase item in restorableCosmosDBAccount.GetRestorableMongoDBDatabasesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableMongodbCollectionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableMongoDBCollections_CosmosDBRestorableMongodbCollectionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableMongodbCollectionList.json + // this example is just showing the usage of "RestorableMongodbCollections_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("98a570f2-63db-4117-91f0-366327b7b353"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string restorableMongoDBDatabaseRid = "PD5DALigDgw="; + await foreach (RestorableMongoDBCollection item in restorableCosmosDBAccount.GetRestorableMongoDBCollectionsAsync(restorableMongoDBDatabaseRid: restorableMongoDBDatabaseRid)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableMongodbResourceList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAllRestorableMongoDBResourceData_CosmosDBRestorableMongodbResourceList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableMongodbResourceList.json + // this example is just showing the usage of "RestorableMongodbResources_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + AzureLocation? restoreLocation = new AzureLocation("WestUS"); + string restoreTimestampInUtc = "06/01/2022 4:56"; + await foreach (RestorableMongoDBResourceData item in restorableCosmosDBAccount.GetAllRestorableMongoDBResourceDataAsync(restoreLocation: restoreLocation, restoreTimestampInUtc: restoreTimestampInUtc)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableGremlinDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableGremlinDatabases_CosmosDBRestorableGremlinDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableGremlinDatabaseList.json + // this example is just showing the usage of "RestorableGremlinDatabases_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (RestorableGremlinDatabase item in restorableCosmosDBAccount.GetRestorableGremlinDatabasesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableGremlinGraphList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableGremlinGraphs_CosmosDBRestorableGremlinGraphList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableGremlinGraphList.json + // this example is just showing the usage of "RestorableGremlinGraphs_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("98a570f2-63db-4117-91f0-366327b7b353"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string restorableGremlinDatabaseRid = "PD5DALigDgw="; + await foreach (RestorableGremlinGraph item in restorableCosmosDBAccount.GetRestorableGremlinGraphsAsync(restorableGremlinDatabaseRid: restorableGremlinDatabaseRid)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableGremlinResourceList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableGremlinResources_CosmosDBRestorableGremlinResourceList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableGremlinResourceList.json + // this example is just showing the usage of "RestorableGremlinResources_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + AzureLocation? restoreLocation = new AzureLocation("WestUS"); + string restoreTimestampInUtc = "06/01/2022 4:56"; + await foreach (RestorableGremlinResourceData item in restorableCosmosDBAccount.GetRestorableGremlinResourcesAsync(restoreLocation: restoreLocation, restoreTimestampInUtc: restoreTimestampInUtc)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableTableList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableTables_CosmosDBRestorableTableList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableTableList.json + // this example is just showing the usage of "RestorableTables_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("98a570f2-63db-4117-91f0-366327b7b353"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (RestorableTable item in restorableCosmosDBAccount.GetRestorableTablesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableTableResourceList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableTableResources_CosmosDBRestorableTableResourceList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableTableResourceList.json + // this example is just showing the usage of "RestorableTableResources_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + AzureLocation? restoreLocation = new AzureLocation("WestUS"); + string restoreTimestampInUtc = "06/01/2022 4:56"; + await foreach (RestorableTableResourceData item in restorableCosmosDBAccount.GetRestorableTableResourcesAsync(restoreLocation: restoreLocation, restoreTimestampInUtc: restoreTimestampInUtc)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Custom/CassandraClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Custom/CassandraClusterResource.cs new file mode 100644 index 0000000000000..5cdc91ed66bfe --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Custom/CassandraClusterResource.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB +{ + /// + /// A Class representing a CassandraCluster along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetCassandraClusterResource method. + /// Otherwise you can get one from its parent resource using the GetCassandraCluster method. + /// + public partial class CassandraClusterResource : ArmResource + { + /// + /// Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated cluster. Use Start to restart the cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate + /// + /// + /// Operation Id + /// CassandraClusters_Deallocate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual async Task DeallocateAsync(WaitUntil waitUntil, CancellationToken cancellationToken) + => await DeallocateAsync(waitUntil, null, cancellationToken).ConfigureAwait(false); + + /// + /// Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated cluster. Use Start to restart the cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate + /// + /// + /// Operation Id + /// CassandraClusters_Deallocate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual ArmOperation Deallocate(WaitUntil waitUntil, CancellationToken cancellationToken) + => Deallocate(waitUntil, null, cancellationToken); + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs index bdd951bcd7c6f..c00ba194f5362 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs @@ -71,9 +71,12 @@ public static partial class ArmCosmosDBModelFactory /// Flag to indicate enabling/disabling of Partition Merge feature on the account. /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + /// Enum to indicate default Priority Level of request for Priority Based Execution. /// Identity for the resource. /// A new instance for mocking. - public static CosmosDBAccountData CosmosDBAccountData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, CosmosDBAccountKind? kind = null, string provisioningState = null, string documentEndpoint = null, CosmosDBAccountOfferType? databaseAccountOfferType = null, IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = null, bool? enableAutomaticFailover = null, ConsistencyPolicy consistencyPolicy = null, IEnumerable capabilities = null, IEnumerable writeLocations = null, IEnumerable readLocations = null, IEnumerable locations = null, IEnumerable failoverPolicies = null, IEnumerable virtualNetworkRules = null, IEnumerable privateEndpointConnections = null, bool? enableMultipleWriteLocations = null, bool? enableCassandraConnector = null, ConnectorOffer? connectorOffer = null, bool? disableKeyBasedMetadataWriteAccess = null, Uri keyVaultKeyUri = null, string defaultIdentity = null, CosmosDBPublicNetworkAccess? publicNetworkAccess = null, bool? isFreeTierEnabled = null, CosmosDBServerVersion? apiServerVersion = null, bool? isAnalyticalStorageEnabled = null, AnalyticalStorageSchemaType? analyticalStorageSchemaType = null, Guid? instanceId = null, CosmosDBAccountCreateMode? createMode = null, CosmosDBAccountRestoreParameters restoreParameters = null, CosmosDBAccountBackupPolicy backupPolicy = null, IEnumerable cors = null, NetworkAclBypass? networkAclBypass = null, IEnumerable networkAclBypassResourceIds = null, EnableFullTextQuery? diagnosticLogEnableFullTextQuery = null, bool? disableLocalAuth = null, int? capacityTotalThroughputLimit = null, bool? enableMaterializedViews = null, DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = null, bool? enableBurstCapacity = null, CosmosDBMinimalTlsVersion? minimalTlsVersion = null, ManagedServiceIdentity identity = null) + public static CosmosDBAccountData CosmosDBAccountData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, CosmosDBAccountKind? kind = null, string provisioningState = null, string documentEndpoint = null, CosmosDBAccountOfferType? databaseAccountOfferType = null, IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = null, bool? enableAutomaticFailover = null, ConsistencyPolicy consistencyPolicy = null, IEnumerable capabilities = null, IEnumerable writeLocations = null, IEnumerable readLocations = null, IEnumerable locations = null, IEnumerable failoverPolicies = null, IEnumerable virtualNetworkRules = null, IEnumerable privateEndpointConnections = null, bool? enableMultipleWriteLocations = null, bool? enableCassandraConnector = null, ConnectorOffer? connectorOffer = null, bool? disableKeyBasedMetadataWriteAccess = null, Uri keyVaultKeyUri = null, string defaultIdentity = null, CosmosDBPublicNetworkAccess? publicNetworkAccess = null, bool? isFreeTierEnabled = null, CosmosDBServerVersion? apiServerVersion = null, bool? isAnalyticalStorageEnabled = null, AnalyticalStorageSchemaType? analyticalStorageSchemaType = null, Guid? instanceId = null, CosmosDBAccountCreateMode? createMode = null, CosmosDBAccountRestoreParameters restoreParameters = null, CosmosDBAccountBackupPolicy backupPolicy = null, IEnumerable cors = null, NetworkAclBypass? networkAclBypass = null, IEnumerable networkAclBypassResourceIds = null, EnableFullTextQuery? diagnosticLogEnableFullTextQuery = null, bool? disableLocalAuth = null, int? capacityTotalThroughputLimit = null, bool? enableMaterializedViews = null, DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = null, bool? enableBurstCapacity = null, CosmosDBMinimalTlsVersion? minimalTlsVersion = null, CustomerManagedKeyStatus? customerManagedKeyStatus = null, bool? enablePriorityBasedExecution = null, DefaultPriorityLevel? defaultPriorityLevel = null, ManagedServiceIdentity identity = null) { tags ??= new Dictionary(); ipRules ??= new List(); @@ -87,7 +90,7 @@ public static CosmosDBAccountData CosmosDBAccountData(ResourceIdentifier id = nu cors ??= new List(); networkAclBypassResourceIds ??= new List(); - return new CosmosDBAccountData(id, name, resourceType, systemData, tags, location, kind, provisioningState, documentEndpoint, databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, consistencyPolicy, capabilities?.ToList(), writeLocations?.ToList(), readLocations?.ToList(), locations?.ToList(), failoverPolicies?.ToList(), virtualNetworkRules?.ToList(), privateEndpointConnections?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType) : null, instanceId, createMode, restoreParameters, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery) : null, disableLocalAuth, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, identity); + return new CosmosDBAccountData(id, name, resourceType, systemData, tags, location, kind, provisioningState, documentEndpoint, databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, consistencyPolicy, capabilities?.ToList(), writeLocations?.ToList(), readLocations?.ToList(), locations?.ToList(), failoverPolicies?.ToList(), virtualNetworkRules?.ToList(), privateEndpointConnections?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType) : null, instanceId, createMode, restoreParameters, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery) : null, disableLocalAuth, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, customerManagedKeyStatus, enablePriorityBasedExecution, defaultPriorityLevel, identity); } /// Initializes a new instance of CosmosDBAccountLocation. @@ -194,9 +197,12 @@ public static DatabaseAccountKeysMetadata DatabaseAccountKeysMetadata(DateTimeOf /// Flag to indicate enabling/disabling of Partition Merge feature on the account. /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + /// Enum to indicate default Priority Level of request for Priority Based Execution. /// Identity for the resource. /// A new instance for mocking. - public static CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, CosmosDBAccountKind? kind = null, ConsistencyPolicy consistencyPolicy = null, IEnumerable locations = null, CosmosDBAccountOfferType databaseAccountOfferType = default, IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = null, bool? enableAutomaticFailover = null, IEnumerable capabilities = null, IEnumerable virtualNetworkRules = null, bool? enableMultipleWriteLocations = null, bool? enableCassandraConnector = null, ConnectorOffer? connectorOffer = null, bool? disableKeyBasedMetadataWriteAccess = null, Uri keyVaultKeyUri = null, string defaultIdentity = null, CosmosDBPublicNetworkAccess? publicNetworkAccess = null, bool? isFreeTierEnabled = null, CosmosDBServerVersion? apiServerVersion = null, bool? isAnalyticalStorageEnabled = null, AnalyticalStorageSchemaType? analyticalStorageSchemaType = null, CosmosDBAccountCreateMode? createMode = null, CosmosDBAccountBackupPolicy backupPolicy = null, IEnumerable cors = null, NetworkAclBypass? networkAclBypass = null, IEnumerable networkAclBypassResourceIds = null, EnableFullTextQuery? diagnosticLogEnableFullTextQuery = null, bool? disableLocalAuth = null, CosmosDBAccountRestoreParameters restoreParameters = null, int? capacityTotalThroughputLimit = null, bool? enableMaterializedViews = null, DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = null, bool? enableBurstCapacity = null, CosmosDBMinimalTlsVersion? minimalTlsVersion = null, ManagedServiceIdentity identity = null) + public static CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, CosmosDBAccountKind? kind = null, ConsistencyPolicy consistencyPolicy = null, IEnumerable locations = null, CosmosDBAccountOfferType databaseAccountOfferType = default, IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = null, bool? enableAutomaticFailover = null, IEnumerable capabilities = null, IEnumerable virtualNetworkRules = null, bool? enableMultipleWriteLocations = null, bool? enableCassandraConnector = null, ConnectorOffer? connectorOffer = null, bool? disableKeyBasedMetadataWriteAccess = null, Uri keyVaultKeyUri = null, string defaultIdentity = null, CosmosDBPublicNetworkAccess? publicNetworkAccess = null, bool? isFreeTierEnabled = null, CosmosDBServerVersion? apiServerVersion = null, bool? isAnalyticalStorageEnabled = null, AnalyticalStorageSchemaType? analyticalStorageSchemaType = null, CosmosDBAccountCreateMode? createMode = null, CosmosDBAccountBackupPolicy backupPolicy = null, IEnumerable cors = null, NetworkAclBypass? networkAclBypass = null, IEnumerable networkAclBypassResourceIds = null, EnableFullTextQuery? diagnosticLogEnableFullTextQuery = null, bool? disableLocalAuth = null, CosmosDBAccountRestoreParameters restoreParameters = null, int? capacityTotalThroughputLimit = null, bool? enableMaterializedViews = null, DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = null, bool? enableBurstCapacity = null, CosmosDBMinimalTlsVersion? minimalTlsVersion = null, CustomerManagedKeyStatus? customerManagedKeyStatus = null, bool? enablePriorityBasedExecution = null, DefaultPriorityLevel? defaultPriorityLevel = null, ManagedServiceIdentity identity = null) { tags ??= new Dictionary(); locations ??= new List(); @@ -206,7 +212,7 @@ public static CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdate cors ??= new List(); networkAclBypassResourceIds ??= new List(); - return new CosmosDBAccountCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, kind, consistencyPolicy, locations?.ToList(), databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, capabilities?.ToList(), virtualNetworkRules?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType) : null, createMode, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery) : null, disableLocalAuth, restoreParameters, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, identity); + return new CosmosDBAccountCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, kind, consistencyPolicy, locations?.ToList(), databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, capabilities?.ToList(), virtualNetworkRules?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType) : null, createMode, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery) : null, disableLocalAuth, restoreParameters, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, customerManagedKeyStatus, enablePriorityBasedExecution, defaultPriorityLevel, identity); } /// Initializes a new instance of CosmosDBAccountKeyList. @@ -496,13 +502,15 @@ public static ThroughputSettingData ThroughputSettingData(ResourceIdentifier id /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. /// The throughput replace is pending. + /// The offer throughput value to instantly scale up without triggering splits. + /// The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. /// A new instance for mocking. - public static ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsResourceInfo(int? throughput = null, AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string rid = null, float? timestamp = null, ETag? etag = null) + public static ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsResourceInfo(int? throughput = null, AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string instantMaximumThroughput = null, string softAllowedMaximumThroughput = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new ExtendedThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, rid, timestamp, etag); + return new ExtendedThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, instantMaximumThroughput, softAllowedMaximumThroughput, rid, timestamp, etag); } /// Initializes a new instance of ThroughputSettingsResourceInfo. @@ -510,10 +518,12 @@ public static ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsR /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. /// The throughput replace is pending. + /// The offer throughput value to instantly scale up without triggering splits. + /// The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. /// A new instance for mocking. - public static ThroughputSettingsResourceInfo ThroughputSettingsResourceInfo(int? throughput = null, AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null) + public static ThroughputSettingsResourceInfo ThroughputSettingsResourceInfo(int? throughput = null, AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string instantMaximumThroughput = null, string softAllowedMaximumThroughput = null) { - return new ThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending); + return new ThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, instantMaximumThroughput, softAllowedMaximumThroughput); } /// Initializes a new instance of AutoscaleSettingsResourceInfo. @@ -1412,17 +1422,22 @@ public static CassandraClusterData CassandraClusterData(ResourceIdentifier id = /// (Deprecated) Number of hours to wait between taking a backup of the cluster. /// Whether the cluster and associated data centers has been deallocated. /// Whether Cassandra audit logging is enabled. + /// Type of the cluster. If set to Production, some operations might not be permitted on cluster. /// Error related to resource provisioning. + /// Extensions to be added or updated on cluster. + /// List of backup schedules that define when you want to back up your data. /// A new instance for mocking. - public static CassandraClusterProperties CassandraClusterProperties(CassandraProvisioningState? provisioningState = null, string restoreFromBackupId = null, ResourceIdentifier delegatedManagementSubnetId = null, string cassandraVersion = null, string clusterNameOverride = null, CassandraAuthenticationMethod? authenticationMethod = null, string initialCassandraAdminPassword = null, string prometheusEndpointIPAddress = null, bool? isRepairEnabled = null, IEnumerable clientCertificates = null, IEnumerable externalGossipCertificates = null, IEnumerable gossipCertificates = null, IEnumerable externalSeedNodes = null, IEnumerable seedNodes = null, int? hoursBetweenBackups = null, bool? isDeallocated = null, bool? isCassandraAuditLoggingEnabled = null, CassandraError provisionError = null) + public static CassandraClusterProperties CassandraClusterProperties(CassandraProvisioningState? provisioningState = null, string restoreFromBackupId = null, ResourceIdentifier delegatedManagementSubnetId = null, string cassandraVersion = null, string clusterNameOverride = null, CassandraAuthenticationMethod? authenticationMethod = null, string initialCassandraAdminPassword = null, string prometheusEndpointIPAddress = null, bool? isRepairEnabled = null, IEnumerable clientCertificates = null, IEnumerable externalGossipCertificates = null, IEnumerable gossipCertificates = null, IEnumerable externalSeedNodes = null, IEnumerable seedNodes = null, int? hoursBetweenBackups = null, bool? isDeallocated = null, bool? isCassandraAuditLoggingEnabled = null, CassandraClusterType? clusterType = null, CassandraError provisionError = null, IEnumerable extensions = null, IEnumerable backupSchedules = null) { clientCertificates ??= new List(); externalGossipCertificates ??= new List(); gossipCertificates ??= new List(); externalSeedNodes ??= new List(); seedNodes ??= new List(); + extensions ??= new List(); + backupSchedules ??= new List(); - return new CassandraClusterProperties(provisioningState, restoreFromBackupId, delegatedManagementSubnetId, cassandraVersion, clusterNameOverride, authenticationMethod, initialCassandraAdminPassword, prometheusEndpointIPAddress != null ? new CassandraDataCenterSeedNode(prometheusEndpointIPAddress) : null, isRepairEnabled, clientCertificates?.ToList(), externalGossipCertificates?.ToList(), gossipCertificates?.ToList(), externalSeedNodes?.ToList(), seedNodes?.ToList(), hoursBetweenBackups, isDeallocated, isCassandraAuditLoggingEnabled, provisionError); + return new CassandraClusterProperties(provisioningState, restoreFromBackupId, delegatedManagementSubnetId, cassandraVersion, clusterNameOverride, authenticationMethod, initialCassandraAdminPassword, prometheusEndpointIPAddress != null ? new CassandraDataCenterSeedNode(prometheusEndpointIPAddress) : null, isRepairEnabled, clientCertificates?.ToList(), externalGossipCertificates?.ToList(), gossipCertificates?.ToList(), externalSeedNodes?.ToList(), seedNodes?.ToList(), hoursBetweenBackups, isDeallocated, isCassandraAuditLoggingEnabled, clusterType, provisionError, extensions?.ToList(), backupSchedules?.ToList()); } /// Initializes a new instance of CassandraCommandOutput. @@ -1433,16 +1448,16 @@ public static CassandraCommandOutput CassandraCommandOutput(string commandOutput return new CassandraCommandOutput(commandOutput); } - /// Initializes a new instance of CassandraClusterBackupResourceData. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// - /// A new instance for mocking. - public static CassandraClusterBackupResourceData CassandraClusterBackupResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? backupResourceTimestamp = null) + /// Initializes a new instance of CassandraClusterBackupResourceInfo. + /// The unique identifier of backup. + /// The current state of the backup. + /// The time at which the backup process begins. + /// The time at which the backup process ends. + /// The time at which the backup will expire. + /// A new instance for mocking. + public static CassandraClusterBackupResourceInfo CassandraClusterBackupResourceInfo(string backupId = null, CassandraClusterBackupState? backupState = null, DateTimeOffset? backupStartTimestamp = null, DateTimeOffset? backupStopTimestamp = null, DateTimeOffset? backupExpiryTimestamp = null) { - return new CassandraClusterBackupResourceData(id, name, resourceType, systemData, backupResourceTimestamp != null ? new BackupResourceProperties(backupResourceTimestamp) : null); + return new CassandraClusterBackupResourceInfo(backupId, backupState, backupStartTimestamp, backupStopTimestamp, backupExpiryTimestamp); } /// Initializes a new instance of CassandraDataCenterData. @@ -1553,12 +1568,13 @@ public static CassandraClusterPublicStatusDataCentersItem CassandraClusterPublic /// Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. /// Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. /// A float representing the current system-wide CPU utilization as a percentage. + /// If node has been updated to latest model. /// A new instance for mocking. - public static CassandraClusterDataCenterNodeItem CassandraClusterDataCenterNodeItem(string address = null, CassandraNodeState? state = null, string status = null, string cassandraProcessStatus = null, string load = null, IEnumerable tokens = null, int? size = null, Guid? hostId = null, string rack = null, string timestamp = null, long? diskUsedKB = null, long? diskFreeKB = null, long? memoryUsedKB = null, long? memoryBuffersAndCachedKB = null, long? memoryFreeKB = null, long? memoryTotalKB = null, double? cpuUsage = null) + public static CassandraClusterDataCenterNodeItem CassandraClusterDataCenterNodeItem(string address = null, CassandraNodeState? state = null, string status = null, string cassandraProcessStatus = null, string load = null, IEnumerable tokens = null, int? size = null, Guid? hostId = null, string rack = null, string timestamp = null, long? diskUsedKB = null, long? diskFreeKB = null, long? memoryUsedKB = null, long? memoryBuffersAndCachedKB = null, long? memoryFreeKB = null, long? memoryTotalKB = null, double? cpuUsage = null, bool? isLatestModel = null) { tokens ??= new List(); - return new CassandraClusterDataCenterNodeItem(address, state, status, cassandraProcessStatus, load, tokens?.ToList(), size, hostId, rack, timestamp, diskUsedKB, diskFreeKB, memoryUsedKB, memoryBuffersAndCachedKB, memoryFreeKB, memoryTotalKB, cpuUsage); + return new CassandraClusterDataCenterNodeItem(address, state, status, cassandraProcessStatus, load, tokens?.ToList(), size, hostId, rack, timestamp, diskUsedKB, diskFreeKB, memoryUsedKB, memoryBuffersAndCachedKB, memoryFreeKB, memoryTotalKB, cpuUsage, isLatestModel); } /// Initializes a new instance of MongoClusterData. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResource.cs deleted file mode 100644 index 61e4c289ee160..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResource.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.CosmosDB -{ - /// - /// A Class representing a CassandraClusterBackupResource along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetCassandraClusterBackupResource method. - /// Otherwise you can get one from its parent resource using the GetCassandraClusterBackupResource method. - /// - public partial class CassandraClusterBackupResource : ArmResource - { - /// Generate the resource identifier of a instance. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string backupId) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _cassandraClusterBackupResourceCassandraClustersClientDiagnostics; - private readonly CassandraClustersRestOperations _cassandraClusterBackupResourceCassandraClustersRestClient; - private readonly CassandraClusterBackupResourceData _data; - - /// Initializes a new instance of the class for mocking. - protected CassandraClusterBackupResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal CassandraClusterBackupResource(ArmClient client, CassandraClusterBackupResourceData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal CassandraClusterBackupResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _cassandraClusterBackupResourceCassandraClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CosmosDB", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string cassandraClusterBackupResourceCassandraClustersApiVersion); - _cassandraClusterBackupResourceCassandraClustersRestClient = new CassandraClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, cassandraClusterBackupResourceCassandraClustersApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.DocumentDB/cassandraClusters/backups"; - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual CassandraClusterBackupResourceData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResource.Get"); - scope.Start(); - try - { - var response = await _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResource.Get"); - scope.Start(); - try - { - var response = _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs deleted file mode 100644 index 0cfe82b9ba77d..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.CosmosDB -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetCassandraClusterBackupResources method from an instance of . - /// - public partial class CassandraClusterBackupResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _cassandraClusterBackupResourceCassandraClustersClientDiagnostics; - private readonly CassandraClustersRestOperations _cassandraClusterBackupResourceCassandraClustersRestClient; - - /// Initializes a new instance of the class for mocking. - protected CassandraClusterBackupResourceCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal CassandraClusterBackupResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _cassandraClusterBackupResourceCassandraClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CosmosDB", CassandraClusterBackupResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(CassandraClusterBackupResource.ResourceType, out string cassandraClusterBackupResourceCassandraClustersApiVersion); - _cassandraClusterBackupResourceCassandraClustersRestClient = new CassandraClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, cassandraClusterBackupResourceCassandraClustersApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != CassandraClusterResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, CassandraClusterResource.ResourceType), nameof(id)); - } - - /// - /// Get the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.Get"); - scope.Start(); - try - { - var response = await _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.Get"); - scope.Start(); - try - { - var response = _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List the backups of this cluster that are available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups - /// - /// - /// Operation Id - /// CassandraClusters_ListBackups - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraClusterBackupResourceCassandraClustersRestClient.CreateListBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CassandraClusterBackupResource(Client, CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(e)), _cassandraClusterBackupResourceCassandraClustersClientDiagnostics, Pipeline, "CassandraClusterBackupResourceCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// List the backups of this cluster that are available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups - /// - /// - /// Operation Id - /// CassandraClusters_ListBackups - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraClusterBackupResourceCassandraClustersRestClient.CreateListBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CassandraClusterBackupResource(Client, CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(e)), _cassandraClusterBackupResourceCassandraClustersClientDiagnostics, Pipeline, "CassandraClusterBackupResourceCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.Exists"); - scope.Start(); - try - { - var response = await _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.Exists"); - scope.Start(); - try - { - var response = _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.GetIfExists"); - scope.Start(); - try - { - var response = _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceData.cs deleted file mode 100644 index 34396aff9db21..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceData.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; -using Azure.ResourceManager.CosmosDB.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.CosmosDB -{ - /// - /// A class representing the CassandraClusterBackupResource data model. - /// A restorable backup of a Cassandra cluster. - /// - public partial class CassandraClusterBackupResourceData : ResourceData - { - /// Initializes a new instance of CassandraClusterBackupResourceData. - public CassandraClusterBackupResourceData() - { - } - - /// Initializes a new instance of CassandraClusterBackupResourceData. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// - internal CassandraClusterBackupResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BackupResourceProperties properties) : base(id, name, resourceType, systemData) - { - Properties = properties; - } - - /// Gets or sets the properties. - internal BackupResourceProperties Properties { get; set; } - /// The time this backup was taken, formatted like 2021-01-21T17:35:21. - public DateTimeOffset? BackupResourceTimestamp - { - get => Properties is null ? default : Properties.Timestamp; - set - { - if (Properties is null) - Properties = new BackupResourceProperties(); - Properties.Timestamp = value; - } - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs index 3c08d622e83c8..d39dab81db9ce 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs @@ -10,6 +10,7 @@ using System.Globalization; using System.Threading; using System.Threading.Tasks; +using Autorest.CSharp.Core; using Azure; using Azure.Core; using Azure.Core.Pipeline; @@ -89,59 +90,6 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of CassandraClusterBackupResources in the CassandraCluster. - /// An object representing collection of CassandraClusterBackupResources and their operations over a CassandraClusterBackupResource. - public virtual CassandraClusterBackupResourceCollection GetCassandraClusterBackupResources() - { - return GetCachedClient(Client => new CassandraClusterBackupResourceCollection(Client, Id)); - } - - /// - /// Get the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public virtual async Task> GetCassandraClusterBackupResourceAsync(string backupId, CancellationToken cancellationToken = default) - { - return await GetCassandraClusterBackupResources().GetAsync(backupId, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public virtual Response GetCassandraClusterBackupResource(string backupId, CancellationToken cancellationToken = default) - { - return GetCassandraClusterBackupResources().Get(backupId, cancellationToken); - } - /// Gets a collection of CassandraDataCenterResources in the CassandraCluster. /// An object representing collection of CassandraDataCenterResources and their operations over a CassandraDataCenterResource. public virtual CassandraDataCenterCollection GetCassandraDataCenters() @@ -479,6 +427,118 @@ public virtual ArmOperation InvokeCommand(WaitUntil wait } } + /// + /// List the backups of this cluster that are available to restore. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups + /// + /// + /// Operation Id + /// CassandraClusters_ListBackups + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBackupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraClusterRestClient.CreateListBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, CassandraClusterBackupResourceInfo.DeserializeCassandraClusterBackupResourceInfo, _cassandraClusterClientDiagnostics, Pipeline, "CassandraClusterResource.GetBackups", "value", null, cancellationToken); + } + + /// + /// List the backups of this cluster that are available to restore. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups + /// + /// + /// Operation Id + /// CassandraClusters_ListBackups + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBackups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraClusterRestClient.CreateListBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, CassandraClusterBackupResourceInfo.DeserializeCassandraClusterBackupResourceInfo, _cassandraClusterClientDiagnostics, Pipeline, "CassandraClusterResource.GetBackups", "value", null, cancellationToken); + } + + /// + /// Get the properties of an individual backup of this cluster that is available to restore. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} + /// + /// + /// Operation Id + /// CassandraClusters_GetBackup + /// + /// + /// + /// Id of a restorable backup of a Cassandra cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetBackupAsync(string backupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); + + using var scope = _cassandraClusterClientDiagnostics.CreateScope("CassandraClusterResource.GetBackup"); + scope.Start(); + try + { + var response = await _cassandraClusterRestClient.GetBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the properties of an individual backup of this cluster that is available to restore. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} + /// + /// + /// Operation Id + /// CassandraClusters_GetBackup + /// + /// + /// + /// Id of a restorable backup of a Cassandra cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetBackup(string backupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); + + using var scope = _cassandraClusterClientDiagnostics.CreateScope("CassandraClusterResource.GetBackup"); + scope.Start(); + try + { + var response = _cassandraClusterRestClient.GetBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated cluster. Use Start to restart the cluster. /// @@ -493,15 +553,16 @@ public virtual ArmOperation InvokeCommand(WaitUntil wait /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Force to deallocate a cluster of Cluster Type Production. Force to deallocate a cluster of Cluster Type Production might cause data loss. /// The cancellation token to use. - public virtual async Task DeallocateAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task DeallocateAsync(WaitUntil waitUntil, bool? xMsForceDeallocate = null, CancellationToken cancellationToken = default) { using var scope = _cassandraClusterClientDiagnostics.CreateScope("CassandraClusterResource.Deallocate"); scope.Start(); try { - var response = await _cassandraClusterRestClient.DeallocateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new CosmosDBArmOperation(_cassandraClusterClientDiagnostics, Pipeline, _cassandraClusterRestClient.CreateDeallocateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _cassandraClusterRestClient.DeallocateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsForceDeallocate, cancellationToken).ConfigureAwait(false); + var operation = new CosmosDBArmOperation(_cassandraClusterClientDiagnostics, Pipeline, _cassandraClusterRestClient.CreateDeallocateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsForceDeallocate).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -527,15 +588,16 @@ public virtual async Task DeallocateAsync(WaitUntil waitUntil, Can /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Force to deallocate a cluster of Cluster Type Production. Force to deallocate a cluster of Cluster Type Production might cause data loss. /// The cancellation token to use. - public virtual ArmOperation Deallocate(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Deallocate(WaitUntil waitUntil, bool? xMsForceDeallocate = null, CancellationToken cancellationToken = default) { using var scope = _cassandraClusterClientDiagnostics.CreateScope("CassandraClusterResource.Deallocate"); scope.Start(); try { - var response = _cassandraClusterRestClient.Deallocate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new CosmosDBArmOperation(_cassandraClusterClientDiagnostics, Pipeline, _cassandraClusterRestClient.CreateDeallocateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _cassandraClusterRestClient.Deallocate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsForceDeallocate, cancellationToken); + var operation = new CosmosDBArmOperation(_cassandraClusterClientDiagnostics, Pipeline, _cassandraClusterRestClient.CreateDeallocateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsForceDeallocate).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs index 3172aa3a75dc9..80edae54484dd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs @@ -87,8 +87,11 @@ public CosmosDBAccountData(AzureLocation location) : base(location) /// Flag to indicate enabling/disabling of Partition Merge feature on the account. /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + /// Enum to indicate default Priority Level of request for Priority Based Execution. /// Identity for the resource. - internal CosmosDBAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, string provisioningState, string documentEndpoint, CosmosDBAccountOfferType? databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, ConsistencyPolicy consistencyPolicy, IList capabilities, IReadOnlyList writeLocations, IReadOnlyList readLocations, IReadOnlyList locations, IReadOnlyList failoverPolicies, IList virtualNetworkRules, IReadOnlyList privateEndpointConnections, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, Guid? instanceId, CosmosDBAccountCreateMode? createMode, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + internal CosmosDBAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, string provisioningState, string documentEndpoint, CosmosDBAccountOfferType? databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, ConsistencyPolicy consistencyPolicy, IList capabilities, IReadOnlyList writeLocations, IReadOnlyList readLocations, IReadOnlyList locations, IReadOnlyList failoverPolicies, IList virtualNetworkRules, IReadOnlyList privateEndpointConnections, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, Guid? instanceId, CosmosDBAccountCreateMode? createMode, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, CustomerManagedKeyStatus? customerManagedKeyStatus, bool? enablePriorityBasedExecution, DefaultPriorityLevel? defaultPriorityLevel, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) { Kind = kind; ProvisioningState = provisioningState; @@ -131,6 +134,9 @@ internal CosmosDBAccountData(ResourceIdentifier id, string name, ResourceType re EnablePartitionMerge = enablePartitionMerge; EnableBurstCapacity = enableBurstCapacity; MinimalTlsVersion = minimalTlsVersion; + CustomerManagedKeyStatus = customerManagedKeyStatus; + EnablePriorityBasedExecution = enablePriorityBasedExecution; + DefaultPriorityLevel = defaultPriorityLevel; Identity = identity; } @@ -268,6 +274,12 @@ public int? CapacityTotalThroughputLimit public bool? EnableBurstCapacity { get; set; } /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. public CosmosDBMinimalTlsVersion? MinimalTlsVersion { get; set; } + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + public CustomerManagedKeyStatus? CustomerManagedKeyStatus { get; set; } + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + public bool? EnablePriorityBasedExecution { get; set; } + /// Enum to indicate default Priority Level of request for Priority Based Execution. + public DefaultPriorityLevel? DefaultPriorityLevel { get; set; } /// Identity for the resource. public ManagedServiceIdentity Identity { get; set; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/CosmosDBExtensions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/CosmosDBExtensions.cs index b1a35e4957e02..19a6e68aed87a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/CosmosDBExtensions.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/CosmosDBExtensions.cs @@ -692,25 +692,6 @@ public static CassandraClusterResource GetCassandraClusterResource(this ArmClien } #endregion - #region CassandraClusterBackupResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static CassandraClusterBackupResource GetCassandraClusterBackupResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - CassandraClusterBackupResource.ValidateResourceId(id); - return new CassandraClusterBackupResource(client, id); - } - ); - } - #endregion - #region CassandraDataCenterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs deleted file mode 100644 index c3eefe00ba272..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.CosmosDB.Models -{ - internal partial class BackupResourceProperties : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Timestamp)) - { - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp.Value, "O"); - } - writer.WriteEndObject(); - } - - internal static BackupResourceProperties DeserializeBackupResourceProperties(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional timestamp = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - } - return new BackupResourceProperties(Optional.ToNullable(timestamp)); - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs deleted file mode 100644 index 4ebac73a40b33..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.CosmosDB.Models -{ - /// The BackupResourceProperties. - internal partial class BackupResourceProperties - { - /// Initializes a new instance of BackupResourceProperties. - public BackupResourceProperties() - { - } - - /// Initializes a new instance of BackupResourceProperties. - /// The time this backup was taken, formatted like 2021-01-21T17:35:21. - internal BackupResourceProperties(DateTimeOffset? timestamp) - { - Timestamp = timestamp; - } - - /// The time this backup was taken, formatted like 2021-01-21T17:35:21. - public DateTimeOffset? Timestamp { get; set; } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceData.Serialization.cs deleted file mode 100644 index 6f2b4ee52dd72..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceData.Serialization.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.CosmosDB.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.CosmosDB -{ - public partial class CassandraClusterBackupResourceData : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Properties)) - { - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); - } - writer.WriteEndObject(); - } - - internal static CassandraClusterBackupResourceData DeserializeCassandraClusterBackupResourceData(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional properties = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - Optional systemData = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - properties = BackupResourceProperties.DeserializeBackupResourceProperties(property.Value); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - } - return new CassandraClusterBackupResourceData(id, name, type, systemData.Value, properties.Value); - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.Serialization.cs new file mode 100644 index 0000000000000..e31e3bc49d4bb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraClusterBackupResourceInfo + { + internal static CassandraClusterBackupResourceInfo DeserializeCassandraClusterBackupResourceInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional backupId = default; + Optional backupState = default; + Optional backupStartTimestamp = default; + Optional backupStopTimestamp = default; + Optional backupExpiryTimestamp = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("backupId"u8)) + { + backupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("backupState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupState = new CassandraClusterBackupState(property.Value.GetString()); + continue; + } + if (property.NameEquals("backupStartTimestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupStartTimestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("backupStopTimestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupStopTimestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("backupExpiryTimestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupExpiryTimestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new CassandraClusterBackupResourceInfo(backupId.Value, Optional.ToNullable(backupState), Optional.ToNullable(backupStartTimestamp), Optional.ToNullable(backupStopTimestamp), Optional.ToNullable(backupExpiryTimestamp)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.cs new file mode 100644 index 0000000000000..6b4e43864661a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A restorable backup of a Cassandra cluster. + public partial class CassandraClusterBackupResourceInfo + { + /// Initializes a new instance of CassandraClusterBackupResourceInfo. + internal CassandraClusterBackupResourceInfo() + { + } + + /// Initializes a new instance of CassandraClusterBackupResourceInfo. + /// The unique identifier of backup. + /// The current state of the backup. + /// The time at which the backup process begins. + /// The time at which the backup process ends. + /// The time at which the backup will expire. + internal CassandraClusterBackupResourceInfo(string backupId, CassandraClusterBackupState? backupState, DateTimeOffset? backupStartTimestamp, DateTimeOffset? backupStopTimestamp, DateTimeOffset? backupExpiryTimestamp) + { + BackupId = backupId; + BackupState = backupState; + BackupStartTimestamp = backupStartTimestamp; + BackupStopTimestamp = backupStopTimestamp; + BackupExpiryTimestamp = backupExpiryTimestamp; + } + + /// The unique identifier of backup. + public string BackupId { get; } + /// The current state of the backup. + public CassandraClusterBackupState? BackupState { get; } + /// The time at which the backup process begins. + public DateTimeOffset? BackupStartTimestamp { get; } + /// The time at which the backup process ends. + public DateTimeOffset? BackupStopTimestamp { get; } + /// The time at which the backup will expire. + public DateTimeOffset? BackupExpiryTimestamp { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.Serialization.cs new file mode 100644 index 0000000000000..a2fc2dc843896 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraClusterBackupSchedule : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ScheduleName)) + { + writer.WritePropertyName("scheduleName"u8); + writer.WriteStringValue(ScheduleName); + } + if (Optional.IsDefined(CronExpression)) + { + writer.WritePropertyName("cronExpression"u8); + writer.WriteStringValue(CronExpression); + } + if (Optional.IsDefined(RetentionInHours)) + { + writer.WritePropertyName("retentionInHours"u8); + writer.WriteNumberValue(RetentionInHours.Value); + } + writer.WriteEndObject(); + } + + internal static CassandraClusterBackupSchedule DeserializeCassandraClusterBackupSchedule(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional scheduleName = default; + Optional cronExpression = default; + Optional retentionInHours = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scheduleName"u8)) + { + scheduleName = property.Value.GetString(); + continue; + } + if (property.NameEquals("cronExpression"u8)) + { + cronExpression = property.Value.GetString(); + continue; + } + if (property.NameEquals("retentionInHours"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + retentionInHours = property.Value.GetInt32(); + continue; + } + } + return new CassandraClusterBackupSchedule(scheduleName.Value, cronExpression.Value, Optional.ToNullable(retentionInHours)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.cs new file mode 100644 index 0000000000000..7276bb060849b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The CassandraClusterBackupSchedule. + public partial class CassandraClusterBackupSchedule + { + /// Initializes a new instance of CassandraClusterBackupSchedule. + public CassandraClusterBackupSchedule() + { + } + + /// Initializes a new instance of CassandraClusterBackupSchedule. + /// The unique identifier of backup schedule. + /// The cron expression that defines when you want to back up your data. + /// The retention period (hours) of the backups. If you want to retain data forever, set retention to 0. + internal CassandraClusterBackupSchedule(string scheduleName, string cronExpression, int? retentionInHours) + { + ScheduleName = scheduleName; + CronExpression = cronExpression; + RetentionInHours = retentionInHours; + } + + /// The unique identifier of backup schedule. + public string ScheduleName { get; set; } + /// The cron expression that defines when you want to back up your data. + public string CronExpression { get; set; } + /// The retention period (hours) of the backups. If you want to retain data forever, set retention to 0. + public int? RetentionInHours { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupState.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupState.cs new file mode 100644 index 0000000000000..ba4188c7a3012 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The current state of the backup. + public readonly partial struct CassandraClusterBackupState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CassandraClusterBackupState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InitiatedValue = "Initiated"; + private const string InProgressValue = "InProgress"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + + /// Initiated. + public static CassandraClusterBackupState Initiated { get; } = new CassandraClusterBackupState(InitiatedValue); + /// InProgress. + public static CassandraClusterBackupState InProgress { get; } = new CassandraClusterBackupState(InProgressValue); + /// Succeeded. + public static CassandraClusterBackupState Succeeded { get; } = new CassandraClusterBackupState(SucceededValue); + /// Failed. + public static CassandraClusterBackupState Failed { get; } = new CassandraClusterBackupState(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(CassandraClusterBackupState left, CassandraClusterBackupState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CassandraClusterBackupState left, CassandraClusterBackupState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CassandraClusterBackupState(string value) => new CassandraClusterBackupState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CassandraClusterBackupState other && Equals(other); + /// + public bool Equals(CassandraClusterBackupState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs index 4559539d64a1a..317b2da083f01 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs @@ -37,6 +37,7 @@ internal static CassandraClusterDataCenterNodeItem DeserializeCassandraClusterDa Optional memoryFreeKB = default; Optional memoryTotalKB = default; Optional cpuUsage = default; + Optional isLatestModel = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("address"u8)) @@ -173,8 +174,17 @@ internal static CassandraClusterDataCenterNodeItem DeserializeCassandraClusterDa cpuUsage = property.Value.GetDouble(); continue; } + if (property.NameEquals("isLatestModel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isLatestModel = property.Value.GetBoolean(); + continue; + } } - return new CassandraClusterDataCenterNodeItem(address.Value, Optional.ToNullable(state), status.Value, cassandraProcessStatus.Value, load.Value, Optional.ToList(tokens), Optional.ToNullable(size), Optional.ToNullable(hostId), rack.Value, timestamp.Value, Optional.ToNullable(diskUsedKB), Optional.ToNullable(diskFreeKB), Optional.ToNullable(memoryUsedKB), Optional.ToNullable(memoryBuffersAndCachedKB), Optional.ToNullable(memoryFreeKB), Optional.ToNullable(memoryTotalKB), Optional.ToNullable(cpuUsage)); + return new CassandraClusterDataCenterNodeItem(address.Value, Optional.ToNullable(state), status.Value, cassandraProcessStatus.Value, load.Value, Optional.ToList(tokens), Optional.ToNullable(size), Optional.ToNullable(hostId), rack.Value, timestamp.Value, Optional.ToNullable(diskUsedKB), Optional.ToNullable(diskFreeKB), Optional.ToNullable(memoryUsedKB), Optional.ToNullable(memoryBuffersAndCachedKB), Optional.ToNullable(memoryFreeKB), Optional.ToNullable(memoryTotalKB), Optional.ToNullable(cpuUsage), Optional.ToNullable(isLatestModel)); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs index a1ee7125f2ccc..2263897d088d6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs @@ -38,7 +38,8 @@ internal CassandraClusterDataCenterNodeItem() /// Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. /// Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. /// A float representing the current system-wide CPU utilization as a percentage. - internal CassandraClusterDataCenterNodeItem(string address, CassandraNodeState? state, string status, string cassandraProcessStatus, string load, IReadOnlyList tokens, int? size, Guid? hostId, string rack, string timestamp, long? diskUsedKB, long? diskFreeKB, long? memoryUsedKB, long? memoryBuffersAndCachedKB, long? memoryFreeKB, long? memoryTotalKB, double? cpuUsage) + /// If node has been updated to latest model. + internal CassandraClusterDataCenterNodeItem(string address, CassandraNodeState? state, string status, string cassandraProcessStatus, string load, IReadOnlyList tokens, int? size, Guid? hostId, string rack, string timestamp, long? diskUsedKB, long? diskFreeKB, long? memoryUsedKB, long? memoryBuffersAndCachedKB, long? memoryFreeKB, long? memoryTotalKB, double? cpuUsage, bool? isLatestModel) { Address = address; State = state; @@ -57,6 +58,7 @@ internal CassandraClusterDataCenterNodeItem(string address, CassandraNodeState? MemoryFreeKB = memoryFreeKB; MemoryTotalKB = memoryTotalKB; CpuUsage = cpuUsage; + IsLatestModel = isLatestModel; } /// The node's IP address. @@ -93,5 +95,7 @@ internal CassandraClusterDataCenterNodeItem(string address, CassandraNodeState? public long? MemoryTotalKB { get; } /// A float representing the current system-wide CPU utilization as a percentage. public double? CpuUsage { get; } + /// If node has been updated to latest model. + public bool? IsLatestModel { get; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs index e388325d8e83f..8cbe86ba80390 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs @@ -106,11 +106,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("cassandraAuditLoggingEnabled"u8); writer.WriteBooleanValue(IsCassandraAuditLoggingEnabled.Value); } + if (Optional.IsDefined(ClusterType)) + { + writer.WritePropertyName("clusterType"u8); + writer.WriteStringValue(ClusterType.Value.ToString()); + } if (Optional.IsDefined(ProvisionError)) { writer.WritePropertyName("provisionError"u8); writer.WriteObjectValue(ProvisionError); } + if (Optional.IsCollectionDefined(Extensions)) + { + writer.WritePropertyName("extensions"u8); + writer.WriteStartArray(); + foreach (var item in Extensions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(BackupSchedules)) + { + writer.WritePropertyName("backupSchedules"u8); + writer.WriteStartArray(); + foreach (var item in BackupSchedules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } writer.WriteEndObject(); } @@ -137,7 +162,10 @@ internal static CassandraClusterProperties DeserializeCassandraClusterProperties Optional hoursBetweenBackups = default; Optional deallocated = default; Optional cassandraAuditLoggingEnabled = default; + Optional clusterType = default; Optional provisionError = default; + Optional> extensions = default; + Optional> backupSchedules = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -302,6 +330,15 @@ internal static CassandraClusterProperties DeserializeCassandraClusterProperties cassandraAuditLoggingEnabled = property.Value.GetBoolean(); continue; } + if (property.NameEquals("clusterType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clusterType = new CassandraClusterType(property.Value.GetString()); + continue; + } if (property.NameEquals("provisionError"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -311,8 +348,36 @@ internal static CassandraClusterProperties DeserializeCassandraClusterProperties provisionError = CassandraError.DeserializeCassandraError(property.Value); continue; } + if (property.NameEquals("extensions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + extensions = array; + continue; + } + if (property.NameEquals("backupSchedules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CassandraClusterBackupSchedule.DeserializeCassandraClusterBackupSchedule(item)); + } + backupSchedules = array; + continue; + } } - return new CassandraClusterProperties(Optional.ToNullable(provisioningState), restoreFromBackupId.Value, delegatedManagementSubnetId.Value, cassandraVersion.Value, clusterNameOverride.Value, Optional.ToNullable(authenticationMethod), initialCassandraAdminPassword.Value, prometheusEndpoint.Value, Optional.ToNullable(repairEnabled), Optional.ToList(clientCertificates), Optional.ToList(externalGossipCertificates), Optional.ToList(gossipCertificates), Optional.ToList(externalSeedNodes), Optional.ToList(seedNodes), Optional.ToNullable(hoursBetweenBackups), Optional.ToNullable(deallocated), Optional.ToNullable(cassandraAuditLoggingEnabled), provisionError.Value); + return new CassandraClusterProperties(Optional.ToNullable(provisioningState), restoreFromBackupId.Value, delegatedManagementSubnetId.Value, cassandraVersion.Value, clusterNameOverride.Value, Optional.ToNullable(authenticationMethod), initialCassandraAdminPassword.Value, prometheusEndpoint.Value, Optional.ToNullable(repairEnabled), Optional.ToList(clientCertificates), Optional.ToList(externalGossipCertificates), Optional.ToList(gossipCertificates), Optional.ToList(externalSeedNodes), Optional.ToList(seedNodes), Optional.ToNullable(hoursBetweenBackups), Optional.ToNullable(deallocated), Optional.ToNullable(cassandraAuditLoggingEnabled), Optional.ToNullable(clusterType), provisionError.Value, Optional.ToList(extensions), Optional.ToList(backupSchedules)); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs index eb9ad28e5a7c8..e3a8fb2bfe174 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs @@ -21,6 +21,8 @@ public CassandraClusterProperties() GossipCertificates = new ChangeTrackingList(); ExternalSeedNodes = new ChangeTrackingList(); SeedNodes = new ChangeTrackingList(); + Extensions = new ChangeTrackingList(); + BackupSchedules = new ChangeTrackingList(); } /// Initializes a new instance of CassandraClusterProperties. @@ -41,8 +43,11 @@ public CassandraClusterProperties() /// (Deprecated) Number of hours to wait between taking a backup of the cluster. /// Whether the cluster and associated data centers has been deallocated. /// Whether Cassandra audit logging is enabled. + /// Type of the cluster. If set to Production, some operations might not be permitted on cluster. /// Error related to resource provisioning. - internal CassandraClusterProperties(CassandraProvisioningState? provisioningState, string restoreFromBackupId, ResourceIdentifier delegatedManagementSubnetId, string cassandraVersion, string clusterNameOverride, CassandraAuthenticationMethod? authenticationMethod, string initialCassandraAdminPassword, CassandraDataCenterSeedNode prometheusEndpoint, bool? isRepairEnabled, IList clientCertificates, IList externalGossipCertificates, IReadOnlyList gossipCertificates, IList externalSeedNodes, IReadOnlyList seedNodes, int? hoursBetweenBackups, bool? isDeallocated, bool? isCassandraAuditLoggingEnabled, CassandraError provisionError) + /// Extensions to be added or updated on cluster. + /// List of backup schedules that define when you want to back up your data. + internal CassandraClusterProperties(CassandraProvisioningState? provisioningState, string restoreFromBackupId, ResourceIdentifier delegatedManagementSubnetId, string cassandraVersion, string clusterNameOverride, CassandraAuthenticationMethod? authenticationMethod, string initialCassandraAdminPassword, CassandraDataCenterSeedNode prometheusEndpoint, bool? isRepairEnabled, IList clientCertificates, IList externalGossipCertificates, IReadOnlyList gossipCertificates, IList externalSeedNodes, IReadOnlyList seedNodes, int? hoursBetweenBackups, bool? isDeallocated, bool? isCassandraAuditLoggingEnabled, CassandraClusterType? clusterType, CassandraError provisionError, IList extensions, IList backupSchedules) { ProvisioningState = provisioningState; RestoreFromBackupId = restoreFromBackupId; @@ -61,7 +66,10 @@ internal CassandraClusterProperties(CassandraProvisioningState? provisioningStat HoursBetweenBackups = hoursBetweenBackups; IsDeallocated = isDeallocated; IsCassandraAuditLoggingEnabled = isCassandraAuditLoggingEnabled; + ClusterType = clusterType; ProvisionError = provisionError; + Extensions = extensions; + BackupSchedules = backupSchedules; } /// The status of the resource at the time the operation was called. @@ -110,7 +118,13 @@ public string PrometheusEndpointIPAddress public bool? IsDeallocated { get; set; } /// Whether Cassandra audit logging is enabled. public bool? IsCassandraAuditLoggingEnabled { get; set; } + /// Type of the cluster. If set to Production, some operations might not be permitted on cluster. + public CassandraClusterType? ClusterType { get; set; } /// Error related to resource provisioning. public CassandraError ProvisionError { get; set; } + /// Extensions to be added or updated on cluster. + public IList Extensions { get; } + /// List of backup schedules that define when you want to back up your data. + public IList BackupSchedules { get; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterType.cs new file mode 100644 index 0000000000000..350b95552df03 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Type of the cluster. If set to Production, some operations might not be permitted on cluster. + public readonly partial struct CassandraClusterType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CassandraClusterType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ProductionValue = "Production"; + private const string NonProductionValue = "NonProduction"; + + /// Production. + public static CassandraClusterType Production { get; } = new CassandraClusterType(ProductionValue); + /// NonProduction. + public static CassandraClusterType NonProduction { get; } = new CassandraClusterType(NonProductionValue); + /// Determines if two values are the same. + public static bool operator ==(CassandraClusterType left, CassandraClusterType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CassandraClusterType left, CassandraClusterType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CassandraClusterType(string value) => new CassandraClusterType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CassandraClusterType other && Equals(other); + /// + public bool Equals(CassandraClusterType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs index bbcb69a41a876..5d93d78bf5fa8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs @@ -19,6 +19,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(KeyspaceName); writer.WritePropertyName("tableName"u8); writer.WriteStringValue(TableName); + if (Optional.IsDefined(RemoteAccountName)) + { + writer.WritePropertyName("remoteAccountName"u8); + writer.WriteStringValue(RemoteAccountName); + } writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); writer.WriteEndObject(); @@ -32,6 +37,7 @@ internal static CosmosCassandraDataTransferDataSourceSink DeserializeCosmosCassa } string keyspaceName = default; string tableName = default; + Optional remoteAccountName = default; DataTransferComponent component = default; foreach (var property in element.EnumerateObject()) { @@ -45,13 +51,18 @@ internal static CosmosCassandraDataTransferDataSourceSink DeserializeCosmosCassa tableName = property.Value.GetString(); continue; } + if (property.NameEquals("remoteAccountName"u8)) + { + remoteAccountName = property.Value.GetString(); + continue; + } if (property.NameEquals("component"u8)) { component = new DataTransferComponent(property.Value.GetString()); continue; } } - return new CosmosCassandraDataTransferDataSourceSink(component, keyspaceName, tableName); + return new CosmosCassandraDataTransferDataSourceSink(component, keyspaceName, tableName, remoteAccountName.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs index d9eec6cc215b0..e2723b4a369e8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs @@ -31,10 +31,12 @@ public CosmosCassandraDataTransferDataSourceSink(string keyspaceName, string tab /// /// /// - internal CosmosCassandraDataTransferDataSourceSink(DataTransferComponent component, string keyspaceName, string tableName) : base(component) + /// + internal CosmosCassandraDataTransferDataSourceSink(DataTransferComponent component, string keyspaceName, string tableName, string remoteAccountName) : base(component) { KeyspaceName = keyspaceName; TableName = tableName; + RemoteAccountName = remoteAccountName; Component = component; } @@ -42,5 +44,7 @@ internal CosmosCassandraDataTransferDataSourceSink(DataTransferComponent compone public string KeyspaceName { get; set; } /// Gets or sets the table name. public string TableName { get; set; } + /// Gets or sets the remote account name. + public string RemoteAccountName { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs index 952ffdab53a71..0f50156197e95 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs @@ -233,6 +233,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"u8); writer.WriteStringValue(MinimalTlsVersion.Value.ToString()); } + if (Optional.IsDefined(CustomerManagedKeyStatus)) + { + writer.WritePropertyName("customerManagedKeyStatus"u8); + writer.WriteStringValue(CustomerManagedKeyStatus.Value.ToString()); + } + if (Optional.IsDefined(EnablePriorityBasedExecution)) + { + writer.WritePropertyName("enablePriorityBasedExecution"u8); + writer.WriteBooleanValue(EnablePriorityBasedExecution.Value); + } + if (Optional.IsDefined(DefaultPriorityLevel)) + { + writer.WritePropertyName("defaultPriorityLevel"u8); + writer.WriteStringValue(DefaultPriorityLevel.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -284,6 +299,9 @@ internal static CosmosDBAccountCreateOrUpdateContent DeserializeCosmosDBAccountC Optional enablePartitionMerge = default; Optional enableBurstCapacity = default; Optional minimalTlsVersion = default; + Optional customerManagedKeyStatus = default; + Optional enablePriorityBasedExecution = default; + Optional defaultPriorityLevel = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -679,11 +697,38 @@ internal static CosmosDBAccountCreateOrUpdateContent DeserializeCosmosDBAccountC minimalTlsVersion = new CosmosDBMinimalTlsVersion(property0.Value.GetString()); continue; } + if (property0.NameEquals("customerManagedKeyStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customerManagedKeyStatus = new CustomerManagedKeyStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("enablePriorityBasedExecution"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enablePriorityBasedExecution = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("defaultPriorityLevel"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultPriorityLevel = new DefaultPriorityLevel(property0.Value.GetString()); + continue; + } } continue; } } - return new CosmosDBAccountCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), consistencyPolicy.Value, locations, databaseAccountOfferType, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(createMode), backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), restoreParameters.Value, capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), identity); + return new CosmosDBAccountCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), consistencyPolicy.Value, locations, databaseAccountOfferType, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(createMode), backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), restoreParameters.Value, capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), Optional.ToNullable(customerManagedKeyStatus), Optional.ToNullable(enablePriorityBasedExecution), Optional.ToNullable(defaultPriorityLevel), identity); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs index cbd4b75abefb8..a7d1263e93154 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs @@ -78,8 +78,11 @@ public CosmosDBAccountCreateOrUpdateContent(AzureLocation location, IEnumerable< /// Flag to indicate enabling/disabling of Partition Merge feature on the account. /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + /// Enum to indicate default Priority Level of request for Priority Based Execution. /// Identity for the resource. - internal CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, ConsistencyPolicy consistencyPolicy, IList locations, CosmosDBAccountOfferType databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, IList capabilities, IList virtualNetworkRules, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, CosmosDBAccountCreateMode? createMode, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + internal CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, ConsistencyPolicy consistencyPolicy, IList locations, CosmosDBAccountOfferType databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, IList capabilities, IList virtualNetworkRules, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, CosmosDBAccountCreateMode? createMode, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, CustomerManagedKeyStatus? customerManagedKeyStatus, bool? enablePriorityBasedExecution, DefaultPriorityLevel? defaultPriorityLevel, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) { Kind = kind; ConsistencyPolicy = consistencyPolicy; @@ -115,6 +118,9 @@ internal CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id, string name EnablePartitionMerge = enablePartitionMerge; EnableBurstCapacity = enableBurstCapacity; MinimalTlsVersion = minimalTlsVersion; + CustomerManagedKeyStatus = customerManagedKeyStatus; + EnablePriorityBasedExecution = enablePriorityBasedExecution; + DefaultPriorityLevel = defaultPriorityLevel; Identity = identity; } @@ -236,6 +242,12 @@ public int? CapacityTotalThroughputLimit public bool? EnableBurstCapacity { get; set; } /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. public CosmosDBMinimalTlsVersion? MinimalTlsVersion { get; set; } + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + public CustomerManagedKeyStatus? CustomerManagedKeyStatus { get; set; } + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + public bool? EnablePriorityBasedExecution { get; set; } + /// Enum to indicate default Priority Level of request for Priority Based Execution. + public DefaultPriorityLevel? DefaultPriorityLevel { get; set; } /// Identity for the resource. public ManagedServiceIdentity Identity { get; set; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs index f47aaff16686d..dfa460d24d77b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs @@ -225,6 +225,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"u8); writer.WriteStringValue(MinimalTlsVersion.Value.ToString()); } + if (Optional.IsDefined(CustomerManagedKeyStatus)) + { + writer.WritePropertyName("customerManagedKeyStatus"u8); + writer.WriteStringValue(CustomerManagedKeyStatus.Value.ToString()); + } + if (Optional.IsDefined(EnablePriorityBasedExecution)) + { + writer.WritePropertyName("enablePriorityBasedExecution"u8); + writer.WriteBooleanValue(EnablePriorityBasedExecution.Value); + } + if (Optional.IsDefined(DefaultPriorityLevel)) + { + writer.WritePropertyName("defaultPriorityLevel"u8); + writer.WriteStringValue(DefaultPriorityLevel.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -283,6 +298,9 @@ internal static CosmosDBAccountData DeserializeCosmosDBAccountData(JsonElement e Optional enablePartitionMerge = default; Optional enableBurstCapacity = default; Optional minimalTlsVersion = default; + Optional customerManagedKeyStatus = default; + Optional enablePriorityBasedExecution = default; + Optional defaultPriorityLevel = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -761,11 +779,38 @@ internal static CosmosDBAccountData DeserializeCosmosDBAccountData(JsonElement e minimalTlsVersion = new CosmosDBMinimalTlsVersion(property0.Value.GetString()); continue; } + if (property0.NameEquals("customerManagedKeyStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customerManagedKeyStatus = new CustomerManagedKeyStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("enablePriorityBasedExecution"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enablePriorityBasedExecution = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("defaultPriorityLevel"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultPriorityLevel = new DefaultPriorityLevel(property0.Value.GetString()); + continue; + } } continue; } } - return new CosmosDBAccountData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), provisioningState.Value, documentEndpoint.Value, Optional.ToNullable(databaseAccountOfferType), Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), consistencyPolicy.Value, Optional.ToList(capabilities), Optional.ToList(writeLocations), Optional.ToList(readLocations), Optional.ToList(locations), Optional.ToList(failoverPolicies), Optional.ToList(virtualNetworkRules), Optional.ToList(privateEndpointConnections), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(instanceId), Optional.ToNullable(createMode), restoreParameters.Value, backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), identity); + return new CosmosDBAccountData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), provisioningState.Value, documentEndpoint.Value, Optional.ToNullable(databaseAccountOfferType), Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), consistencyPolicy.Value, Optional.ToList(capabilities), Optional.ToList(writeLocations), Optional.ToList(readLocations), Optional.ToList(locations), Optional.ToList(failoverPolicies), Optional.ToList(virtualNetworkRules), Optional.ToList(privateEndpointConnections), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(instanceId), Optional.ToNullable(createMode), restoreParameters.Value, backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), Optional.ToNullable(customerManagedKeyStatus), Optional.ToNullable(enablePriorityBasedExecution), Optional.ToNullable(defaultPriorityLevel), identity); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs index d138e308f1fe9..963d220e1d555 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs @@ -220,6 +220,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"u8); writer.WriteStringValue(MinimalTlsVersion.Value.ToString()); } + if (Optional.IsDefined(CustomerManagedKeyStatus)) + { + writer.WritePropertyName("customerManagedKeyStatus"u8); + writer.WriteStringValue(CustomerManagedKeyStatus.Value.ToString()); + } + if (Optional.IsDefined(EnablePriorityBasedExecution)) + { + writer.WritePropertyName("enablePriorityBasedExecution"u8); + writer.WriteBooleanValue(EnablePriorityBasedExecution.Value); + } + if (Optional.IsDefined(DefaultPriorityLevel)) + { + writer.WritePropertyName("defaultPriorityLevel"u8); + writer.WriteStringValue(DefaultPriorityLevel.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs index 1f7fb92e08083..67c99f490208b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs @@ -145,5 +145,11 @@ public int? CapacityTotalThroughputLimit public bool? EnableBurstCapacity { get; set; } /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. public CosmosDBMinimalTlsVersion? MinimalTlsVersion { get; set; } + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + public CustomerManagedKeyStatus? CustomerManagedKeyStatus { get; set; } + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + public bool? EnablePriorityBasedExecution { get; set; } + /// Enum to indicate default Priority Level of request for Priority Based Execution. + public DefaultPriorityLevel? DefaultPriorityLevel { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs index 5889e9c32a66b..8befbd2e4b59b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs @@ -17,7 +17,7 @@ public CosmosDBCreateUpdateConfig() /// Initializes a new instance of CosmosDBCreateUpdateConfig. /// Request Units per second. For example, "throughput": 10000. - /// Specifies the Autoscale settings. + /// Specifies the Autoscale settings. Note: Either throughput or autoscaleSettings is required, but not both. internal CosmosDBCreateUpdateConfig(int? throughput, AutoscaleSettings autoscaleSettings) { Throughput = throughput; @@ -26,7 +26,7 @@ internal CosmosDBCreateUpdateConfig(int? throughput, AutoscaleSettings autoscale /// Request Units per second. For example, "throughput": 10000. public int? Throughput { get; set; } - /// Specifies the Autoscale settings. + /// Specifies the Autoscale settings. Note: Either throughput or autoscaleSettings is required, but not both. internal AutoscaleSettings AutoscaleSettings { get; set; } /// Represents maximum throughput, the resource can scale up to. public int? AutoscaleMaxThroughput diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPublicNetworkAccess.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPublicNetworkAccess.cs index 3346e43901f65..9343a56a4f7bf 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPublicNetworkAccess.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPublicNetworkAccess.cs @@ -24,11 +24,14 @@ public CosmosDBPublicNetworkAccess(string value) private const string EnabledValue = "Enabled"; private const string DisabledValue = "Disabled"; + private const string SecuredByPerimeterValue = "SecuredByPerimeter"; /// Enabled. public static CosmosDBPublicNetworkAccess Enabled { get; } = new CosmosDBPublicNetworkAccess(EnabledValue); /// Disabled. public static CosmosDBPublicNetworkAccess Disabled { get; } = new CosmosDBPublicNetworkAccess(DisabledValue); + /// SecuredByPerimeter. + public static CosmosDBPublicNetworkAccess SecuredByPerimeter { get; } = new CosmosDBPublicNetworkAccess(SecuredByPerimeterValue); /// Determines if two values are the same. public static bool operator ==(CosmosDBPublicNetworkAccess left, CosmosDBPublicNetworkAccess right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs index 77100d389fd98..3d71e14fae9f8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs @@ -19,6 +19,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DatabaseName); writer.WritePropertyName("collectionName"u8); writer.WriteStringValue(CollectionName); + if (Optional.IsDefined(RemoteAccountName)) + { + writer.WritePropertyName("remoteAccountName"u8); + writer.WriteStringValue(RemoteAccountName); + } writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); writer.WriteEndObject(); @@ -32,6 +37,7 @@ internal static CosmosMongoDataTransferDataSourceSink DeserializeCosmosMongoData } string databaseName = default; string collectionName = default; + Optional remoteAccountName = default; DataTransferComponent component = default; foreach (var property in element.EnumerateObject()) { @@ -45,13 +51,18 @@ internal static CosmosMongoDataTransferDataSourceSink DeserializeCosmosMongoData collectionName = property.Value.GetString(); continue; } + if (property.NameEquals("remoteAccountName"u8)) + { + remoteAccountName = property.Value.GetString(); + continue; + } if (property.NameEquals("component"u8)) { component = new DataTransferComponent(property.Value.GetString()); continue; } } - return new CosmosMongoDataTransferDataSourceSink(component, databaseName, collectionName); + return new CosmosMongoDataTransferDataSourceSink(component, databaseName, collectionName, remoteAccountName.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs index e6277f0c865c9..e0658195003a9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.CosmosDB.Models { - /// A CosmosDB Cassandra API data source/sink. + /// A CosmosDB Mongo API data source/sink. public partial class CosmosMongoDataTransferDataSourceSink : DataTransferDataSourceSink { /// Initializes a new instance of CosmosMongoDataTransferDataSourceSink. @@ -31,10 +31,12 @@ public CosmosMongoDataTransferDataSourceSink(string databaseName, string collect /// /// /// - internal CosmosMongoDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string collectionName) : base(component) + /// + internal CosmosMongoDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string collectionName, string remoteAccountName) : base(component) { DatabaseName = databaseName; CollectionName = collectionName; + RemoteAccountName = remoteAccountName; Component = component; } @@ -42,5 +44,7 @@ internal CosmosMongoDataTransferDataSourceSink(DataTransferComponent component, public string DatabaseName { get; set; } /// Gets or sets the collection name. public string CollectionName { get; set; } + /// Gets or sets the remote account name. + public string RemoteAccountName { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs index 8b29a34e28eb1..0698f8cde79a9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs @@ -19,6 +19,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DatabaseName); writer.WritePropertyName("containerName"u8); writer.WriteStringValue(ContainerName); + if (Optional.IsDefined(RemoteAccountName)) + { + writer.WritePropertyName("remoteAccountName"u8); + writer.WriteStringValue(RemoteAccountName); + } writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); writer.WriteEndObject(); @@ -32,6 +37,7 @@ internal static CosmosSqlDataTransferDataSourceSink DeserializeCosmosSqlDataTran } string databaseName = default; string containerName = default; + Optional remoteAccountName = default; DataTransferComponent component = default; foreach (var property in element.EnumerateObject()) { @@ -45,13 +51,18 @@ internal static CosmosSqlDataTransferDataSourceSink DeserializeCosmosSqlDataTran containerName = property.Value.GetString(); continue; } + if (property.NameEquals("remoteAccountName"u8)) + { + remoteAccountName = property.Value.GetString(); + continue; + } if (property.NameEquals("component"u8)) { component = new DataTransferComponent(property.Value.GetString()); continue; } } - return new CosmosSqlDataTransferDataSourceSink(component, databaseName, containerName); + return new CosmosSqlDataTransferDataSourceSink(component, databaseName, containerName, remoteAccountName.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs index a7fb15827cfcc..609372f99aadb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.CosmosDB.Models { - /// A CosmosDB Cassandra API data source/sink. + /// A CosmosDB No Sql API data source/sink. public partial class CosmosSqlDataTransferDataSourceSink : DataTransferDataSourceSink { /// Initializes a new instance of CosmosSqlDataTransferDataSourceSink. @@ -31,10 +31,12 @@ public CosmosSqlDataTransferDataSourceSink(string databaseName, string container /// /// /// - internal CosmosSqlDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string containerName) : base(component) + /// + internal CosmosSqlDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string containerName, string remoteAccountName) : base(component) { DatabaseName = databaseName; ContainerName = containerName; + RemoteAccountName = remoteAccountName; Component = component; } @@ -42,5 +44,7 @@ internal CosmosSqlDataTransferDataSourceSink(DataTransferComponent component, st public string DatabaseName { get; set; } /// Gets or sets the container name. public string ContainerName { get; set; } + /// Gets or sets the remote account name. + public string RemoteAccountName { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CustomerManagedKeyStatus.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CustomerManagedKeyStatus.cs new file mode 100644 index 0000000000000..f2a97df6afe80 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CustomerManagedKeyStatus.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + public readonly partial struct CustomerManagedKeyStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CustomerManagedKeyStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToObtainTheAADAuthenticationTokenForTheAccountSDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureActiveDirectoryTokenAcquisitionError4000Value = "Access to your account is currently revoked because the Azure Cosmos DB service is unable to obtain the AAD authentication token for the account's default identity; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-active-directory-token-acquisition-error (4000)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountSKeyVaultKeyUriDoesNotFollowTheExpectedFormatForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideImproperSyntaxDetectedOnTheKeyVaultUriProperty4006Value = "Access to your account is currently revoked because the Azure Cosmos DB account's key vault key URI does not follow the expected format; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#improper-syntax-detected-on-the-key-vault-uri-property (4006)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheCurrentDefaultIdentityNoLongerHasPermissionToTheAssociatedKeyVaultKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideDefaultIdentityIsUnauthorizedToAccessTheAzureKeyVaultKey4002Value = "Access to your account is currently revoked because the current default identity no longer has permission to the associated Key Vault key; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#default-identity-is-unauthorized-to-access-the-azure-key-vault-key (4002)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureKeyVaultDnsNameSpecifiedByTheAccountSKeyvaultkeyuriPropertyCouldNotBeResolvedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideUnableToResolveTheKeyVaultsDns4009Value = "Access to your account is currently revoked because the Azure Key Vault DNS name specified by the account's keyvaultkeyuri property could not be resolved; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#unable-to-resolve-the-key-vaults-dns (4009)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentKeyIsNotFoundOnTheSpecifiedKeyVaultForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4003Value = "Access to your account is currently revoked because the correspondent key is not found on the specified Key Vault; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-key-vault-resource-not-found (4003)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToWrapOrUnwrapTheKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInternalUnwrappingProcedureError4005Value = "Access to your account is currently revoked because the Azure Cosmos DB service is unable to wrap or unwrap the key; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#internal-unwrapping-procedure-error (4005)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountHasAnUndefinedDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInvalidAzureCosmosDBDefaultIdentity4015Value = "Access to your account is currently revoked because the Azure Cosmos DB account has an undefined default identity; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#invalid-azure-cosmos-db-default-identity (4015)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAccessRulesAreBlockingOutboundRequestsToTheAzureKeyVaultServiceForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide4016Value = "Access to your account is currently revoked because the access rules are blocking outbound requests to the Azure Key Vault service; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide (4016)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentAzureKeyVaultWasNotFoundForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4017Value = "Access to your account is currently revoked because the correspondent Azure Key Vault was not found; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-key-vault-resource-not-found (4017)."; + private const string AccessToYourAccountIsCurrentlyRevokedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideValue = "Access to your account is currently revoked; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide"; + private const string AccessToTheConfiguredCustomerManagedKeyConfirmedValue = "Access to the configured customer managed key confirmed."; + + /// Access to your account is currently revoked because the Azure Cosmos DB service is unable to obtain the AAD authentication token for the account's default identity; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-active-directory-token-acquisition-error (4000). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToObtainTheAADAuthenticationTokenForTheAccountSDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureActiveDirectoryTokenAcquisitionError4000 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToObtainTheAADAuthenticationTokenForTheAccountSDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureActiveDirectoryTokenAcquisitionError4000Value); + /// Access to your account is currently revoked because the Azure Cosmos DB account's key vault key URI does not follow the expected format; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#improper-syntax-detected-on-the-key-vault-uri-property (4006). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountSKeyVaultKeyUriDoesNotFollowTheExpectedFormatForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideImproperSyntaxDetectedOnTheKeyVaultUriProperty4006 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountSKeyVaultKeyUriDoesNotFollowTheExpectedFormatForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideImproperSyntaxDetectedOnTheKeyVaultUriProperty4006Value); + /// Access to your account is currently revoked because the current default identity no longer has permission to the associated Key Vault key; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#default-identity-is-unauthorized-to-access-the-azure-key-vault-key (4002). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCurrentDefaultIdentityNoLongerHasPermissionToTheAssociatedKeyVaultKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideDefaultIdentityIsUnauthorizedToAccessTheAzureKeyVaultKey4002 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheCurrentDefaultIdentityNoLongerHasPermissionToTheAssociatedKeyVaultKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideDefaultIdentityIsUnauthorizedToAccessTheAzureKeyVaultKey4002Value); + /// Access to your account is currently revoked because the Azure Key Vault DNS name specified by the account's keyvaultkeyuri property could not be resolved; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#unable-to-resolve-the-key-vaults-dns (4009). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureKeyVaultDnsNameSpecifiedByTheAccountSKeyvaultkeyuriPropertyCouldNotBeResolvedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideUnableToResolveTheKeyVaultsDns4009 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureKeyVaultDnsNameSpecifiedByTheAccountSKeyvaultkeyuriPropertyCouldNotBeResolvedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideUnableToResolveTheKeyVaultsDns4009Value); + /// Access to your account is currently revoked because the correspondent key is not found on the specified Key Vault; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-key-vault-resource-not-found (4003). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentKeyIsNotFoundOnTheSpecifiedKeyVaultForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4003 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentKeyIsNotFoundOnTheSpecifiedKeyVaultForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4003Value); + /// Access to your account is currently revoked because the Azure Cosmos DB service is unable to wrap or unwrap the key; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#internal-unwrapping-procedure-error (4005). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToWrapOrUnwrapTheKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInternalUnwrappingProcedureError4005 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToWrapOrUnwrapTheKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInternalUnwrappingProcedureError4005Value); + /// Access to your account is currently revoked because the Azure Cosmos DB account has an undefined default identity; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#invalid-azure-cosmos-db-default-identity (4015). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountHasAnUndefinedDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInvalidAzureCosmosDBDefaultIdentity4015 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountHasAnUndefinedDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInvalidAzureCosmosDBDefaultIdentity4015Value); + /// Access to your account is currently revoked because the access rules are blocking outbound requests to the Azure Key Vault service; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide (4016). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAccessRulesAreBlockingOutboundRequestsToTheAzureKeyVaultServiceForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide4016 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAccessRulesAreBlockingOutboundRequestsToTheAzureKeyVaultServiceForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide4016Value); + /// Access to your account is currently revoked because the correspondent Azure Key Vault was not found; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-key-vault-resource-not-found (4017). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentAzureKeyVaultWasNotFoundForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4017 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentAzureKeyVaultWasNotFoundForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4017Value); + /// Access to your account is currently revoked; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide. + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideValue); + /// Access to the configured customer managed key confirmed. + public static CustomerManagedKeyStatus AccessToTheConfiguredCustomerManagedKeyConfirmed { get; } = new CustomerManagedKeyStatus(AccessToTheConfiguredCustomerManagedKeyConfirmedValue); + /// Determines if two values are the same. + public static bool operator ==(CustomerManagedKeyStatus left, CustomerManagedKeyStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CustomerManagedKeyStatus left, CustomerManagedKeyStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CustomerManagedKeyStatus(string value) => new CustomerManagedKeyStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CustomerManagedKeyStatus other && Equals(other); + /// + public bool Equals(CustomerManagedKeyStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultPriorityLevel.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultPriorityLevel.cs new file mode 100644 index 0000000000000..a01616b697b9b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultPriorityLevel.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Enum to indicate default priorityLevel of requests. + public readonly partial struct DefaultPriorityLevel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DefaultPriorityLevel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string HighValue = "High"; + private const string LowValue = "Low"; + + /// High. + public static DefaultPriorityLevel High { get; } = new DefaultPriorityLevel(HighValue); + /// Low. + public static DefaultPriorityLevel Low { get; } = new DefaultPriorityLevel(LowValue); + /// Determines if two values are the same. + public static bool operator ==(DefaultPriorityLevel left, DefaultPriorityLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DefaultPriorityLevel left, DefaultPriorityLevel right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DefaultPriorityLevel(string value) => new DefaultPriorityLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DefaultPriorityLevel other && Equals(other); + /// + public bool Equals(DefaultPriorityLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs index 281833e226674..3d5ab3eb49ff0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs @@ -42,6 +42,8 @@ internal static ExtendedThroughputSettingsResourceInfo DeserializeExtendedThroug Optional autoscaleSettings = default; Optional minimumThroughput = default; Optional offerReplacePending = default; + Optional instantMaximumThroughput = default; + Optional softAllowedMaximumThroughput = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -95,8 +97,18 @@ internal static ExtendedThroughputSettingsResourceInfo DeserializeExtendedThroug offerReplacePending = property.Value.GetString(); continue; } + if (property.NameEquals("instantMaximumThroughput"u8)) + { + instantMaximumThroughput = property.Value.GetString(); + continue; + } + if (property.NameEquals("softAllowedMaximumThroughput"u8)) + { + softAllowedMaximumThroughput = property.Value.GetString(); + continue; + } } - return new ExtendedThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + return new ExtendedThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, instantMaximumThroughput.Value, softAllowedMaximumThroughput.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs index f19bfd8672e31..64a3bb91d0596 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs @@ -22,10 +22,12 @@ public ExtendedThroughputSettingsResourceInfo() /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. /// The throughput replace is pending. + /// The offer throughput value to instantly scale up without triggering splits. + /// The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending, string rid, float? timestamp, ETag? etag) : base(throughput, autoscaleSettings, minimumThroughput, offerReplacePending) + internal ExtendedThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending, string instantMaximumThroughput, string softAllowedMaximumThroughput, string rid, float? timestamp, ETag? etag) : base(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, instantMaximumThroughput, softAllowedMaximumThroughput) { Rid = rid; Timestamp = timestamp; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs index 90fdc8cc1b07c..a209c7f06ecde 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { @@ -20,7 +19,7 @@ internal static ListBackups DeserializeListBackups(JsonElement element) { return null; } - Optional> value = default; + Optional> value = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -29,10 +28,10 @@ internal static ListBackups DeserializeListBackups(JsonElement element) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(item)); + array.Add(CassandraClusterBackupResourceInfo.DeserializeCassandraClusterBackupResourceInfo(item)); } value = array; continue; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs index bb47d5d85409a..984fb6dc1f076 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { @@ -17,17 +16,17 @@ internal partial class ListBackups /// Initializes a new instance of ListBackups. internal ListBackups() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of ListBackups. /// Container for array of backups. - internal ListBackups(IReadOnlyList value) + internal ListBackups(IReadOnlyList value) { Value = value; } /// Container for array of backups. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs index 4af5cc1457259..17594bc787086 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs @@ -38,6 +38,8 @@ internal static ThroughputSettingsResourceInfo DeserializeThroughputSettingsReso Optional autoscaleSettings = default; Optional minimumThroughput = default; Optional offerReplacePending = default; + Optional instantMaximumThroughput = default; + Optional softAllowedMaximumThroughput = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -68,8 +70,18 @@ internal static ThroughputSettingsResourceInfo DeserializeThroughputSettingsReso offerReplacePending = property.Value.GetString(); continue; } + if (property.NameEquals("instantMaximumThroughput"u8)) + { + instantMaximumThroughput = property.Value.GetString(); + continue; + } + if (property.NameEquals("softAllowedMaximumThroughput"u8)) + { + softAllowedMaximumThroughput = property.Value.GetString(); + continue; + } } - return new ThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value); + return new ThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, instantMaximumThroughput.Value, softAllowedMaximumThroughput.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs index 142119bf39c96..d4d9026de95a6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs @@ -20,12 +20,16 @@ public ThroughputSettingsResourceInfo() /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. /// The throughput replace is pending. - internal ThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending) + /// The offer throughput value to instantly scale up without triggering splits. + /// The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. + internal ThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending, string instantMaximumThroughput, string softAllowedMaximumThroughput) { Throughput = throughput; AutoscaleSettings = autoscaleSettings; MinimumThroughput = minimumThroughput; OfferReplacePending = offerReplacePending; + InstantMaximumThroughput = instantMaximumThroughput; + SoftAllowedMaximumThroughput = softAllowedMaximumThroughput; } /// Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. @@ -36,5 +40,9 @@ internal ThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResour public string MinimumThroughput { get; } /// The throughput replace is pending. public string OfferReplacePending { get; } + /// The offer throughput value to instantly scale up without triggering splits. + public string InstantMaximumThroughput { get; } + /// The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. + public string SoftAllowedMaximumThroughput { get; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs index 05e8566a997a4..9c65a7fd0ed5e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs @@ -33,7 +33,7 @@ public CassandraClustersRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -671,7 +671,7 @@ internal HttpMessage CreateGetBackupRequest(string subscriptionId, string resour /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetBackupAsync(string subscriptionId, string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) + public async Task> GetBackupAsync(string subscriptionId, string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -684,13 +684,11 @@ public async Task> GetBackupAsync(s { case 200: { - CassandraClusterBackupResourceData value = default; + CassandraClusterBackupResourceInfo value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(document.RootElement); + value = CassandraClusterBackupResourceInfo.DeserializeCassandraClusterBackupResourceInfo(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((CassandraClusterBackupResourceData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -704,7 +702,7 @@ public async Task> GetBackupAsync(s /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response GetBackup(string subscriptionId, string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) + public Response GetBackup(string subscriptionId, string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -717,19 +715,17 @@ public Response GetBackup(string subscriptio { case 200: { - CassandraClusterBackupResourceData value = default; + CassandraClusterBackupResourceInfo value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(document.RootElement); + value = CassandraClusterBackupResourceInfo.DeserializeCassandraClusterBackupResourceInfo(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((CassandraClusterBackupResourceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateDeallocateRequest(string subscriptionId, string resourceGroupName, string clusterName) + internal HttpMessage CreateDeallocateRequest(string subscriptionId, string resourceGroupName, string clusterName, bool? xMsForceDeallocate) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -745,6 +741,10 @@ internal HttpMessage CreateDeallocateRequest(string subscriptionId, string resou uri.AppendPath("/deallocate", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (xMsForceDeallocate != null) + { + request.Headers.Add("x-ms-force-deallocate", xMsForceDeallocate.Value); + } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; @@ -754,16 +754,17 @@ internal HttpMessage CreateDeallocateRequest(string subscriptionId, string resou /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Managed Cassandra cluster name. + /// Force to deallocate a cluster of Cluster Type Production. Force to deallocate a cluster of Cluster Type Production might cause data loss. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task DeallocateAsync(string subscriptionId, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + public async Task DeallocateAsync(string subscriptionId, string resourceGroupName, string clusterName, bool? xMsForceDeallocate = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var message = CreateDeallocateRequest(subscriptionId, resourceGroupName, clusterName); + using var message = CreateDeallocateRequest(subscriptionId, resourceGroupName, clusterName, xMsForceDeallocate); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -778,16 +779,17 @@ public async Task DeallocateAsync(string subscriptionId, string resour /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Managed Cassandra cluster name. + /// Force to deallocate a cluster of Cluster Type Production. Force to deallocate a cluster of Cluster Type Production might cause data loss. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Deallocate(string subscriptionId, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + public Response Deallocate(string subscriptionId, string resourceGroupName, string clusterName, bool? xMsForceDeallocate = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var message = CreateDeallocateRequest(subscriptionId, resourceGroupName, clusterName); + using var message = CreateDeallocateRequest(subscriptionId, resourceGroupName, clusterName, xMsForceDeallocate); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs index 0b8a82792cd9b..77e075133fb62 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs @@ -33,7 +33,7 @@ public CassandraDataCentersRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs index c492127ad13d0..088005408e593 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs @@ -33,7 +33,7 @@ public CassandraResourcesRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRegionRestOperations.cs index 44c1e724b120f..25c848a549ee4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRegionRestOperations.cs @@ -33,7 +33,7 @@ public CollectionPartitionRegionRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRestOperations.cs index c086be9ed93a8..47e2065fc59d2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRestOperations.cs @@ -33,7 +33,7 @@ public CollectionPartitionRestOperations(HttpPipeline pipeline, string applicati { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRegionRestOperations.cs index dd41cc236c309..8fcac73dcbb71 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRegionRestOperations.cs @@ -33,7 +33,7 @@ public CollectionRegionRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRestOperations.cs index e63342ab46c2b..71c1b67c29b28 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRestOperations.cs @@ -33,7 +33,7 @@ public CollectionRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs index e27575c882d1b..0578a000fe9f4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs @@ -33,7 +33,7 @@ public DataTransferJobsRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountRegionRestOperations.cs index ea7fb426d81c5..03f45c2a6ac03 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountRegionRestOperations.cs @@ -33,7 +33,7 @@ public DatabaseAccountRegionRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs index 7d304c5f67ad7..3f05b92627f36 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs @@ -33,7 +33,7 @@ public DatabaseAccountsRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseRestOperations.cs index 6b92f7b7d6a1b..42aeaa1d4a1b1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseRestOperations.cs @@ -33,7 +33,7 @@ public DatabaseRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs index f4a6ef9134467..40d9398be6070 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs @@ -33,7 +33,7 @@ public GraphResourcesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs index aaca2a15404f7..b94f1d97bd9a3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs @@ -33,7 +33,7 @@ public GremlinResourcesRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/LocationsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/LocationsRestOperations.cs index 69ddc872c0a58..3f9b721fcef86 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/LocationsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/LocationsRestOperations.cs @@ -33,7 +33,7 @@ public LocationsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs index 345a7a3340aaf..b257cb393b525 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs @@ -33,7 +33,7 @@ public MongoClustersRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs index 69a75d483635d..859568a24ebb7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs @@ -33,7 +33,7 @@ public MongoDBResourcesRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRegionRestOperations.cs index 1607261b398fe..98f592ca3faa4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRegionRestOperations.cs @@ -33,7 +33,7 @@ public PartitionKeyRangeIdRegionRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRestOperations.cs index 177d359f1c60b..bb414a3bf1c7d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRestOperations.cs @@ -33,7 +33,7 @@ public PartitionKeyRangeIdRestOperations(HttpPipeline pipeline, string applicati { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileRestOperations.cs index fe8c0295e1a53..c00ed68549f43 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileRestOperations.cs @@ -33,7 +33,7 @@ public PercentileRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileSourceTargetRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileSourceTargetRestOperations.cs index 5d02a7093ad55..6727853c379f3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileSourceTargetRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileSourceTargetRestOperations.cs @@ -33,7 +33,7 @@ public PercentileSourceTargetRestOperations(HttpPipeline pipeline, string applic { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileTargetRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileTargetRestOperations.cs index 029de11d05542..411518a32a4af 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileTargetRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileTargetRestOperations.cs @@ -33,7 +33,7 @@ public PercentileTargetRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index c8a01377f74fb..17f8875986da1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -33,7 +33,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index 24bbecd7632e6..6731ff4478a19 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -33,7 +33,7 @@ public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableDatabaseAccountsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableDatabaseAccountsRestOperations.cs index 293020c2d546e..e7d84be8c37a2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableDatabaseAccountsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableDatabaseAccountsRestOperations.cs @@ -33,7 +33,7 @@ public RestorableDatabaseAccountsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinDatabasesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinDatabasesRestOperations.cs index b166e21aaf661..a684664a98dcb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinDatabasesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinDatabasesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableGremlinDatabasesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinGraphsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinGraphsRestOperations.cs index b7261e1edf3f3..562d5938c36ed 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinGraphsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinGraphsRestOperations.cs @@ -33,7 +33,7 @@ public RestorableGremlinGraphsRestOperations(HttpPipeline pipeline, string appli { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinResourcesRestOperations.cs index 491e0a52c006d..cdf9cc26c8256 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinResourcesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableGremlinResourcesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbCollectionsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbCollectionsRestOperations.cs index 5c3591f4fd5d2..941d903e23433 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbCollectionsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbCollectionsRestOperations.cs @@ -33,7 +33,7 @@ public RestorableMongodbCollectionsRestOperations(HttpPipeline pipeline, string { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbDatabasesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbDatabasesRestOperations.cs index d95a8e3e45bb0..82b9c7f4e92f4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbDatabasesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbDatabasesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableMongodbDatabasesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbResourcesRestOperations.cs index a928d5461714d..5e1d6185743a7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbResourcesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableMongodbResourcesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlContainersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlContainersRestOperations.cs index efc9633c797f5..dce44737a2bf6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlContainersRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlContainersRestOperations.cs @@ -33,7 +33,7 @@ public RestorableSqlContainersRestOperations(HttpPipeline pipeline, string appli { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlDatabasesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlDatabasesRestOperations.cs index 789a9361823a5..afae919ede283 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlDatabasesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlDatabasesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableSqlDatabasesRestOperations(HttpPipeline pipeline, string applic { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlResourcesRestOperations.cs index 3ff217dd2a69e..89a71d6fd329b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlResourcesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableSqlResourcesRestOperations(HttpPipeline pipeline, string applic { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTableResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTableResourcesRestOperations.cs index b53887e11b4ef..cfbfa20b3fad4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTableResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTableResourcesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableTableResourcesRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTablesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTablesRestOperations.cs index e925ee574e565..0e15399115750 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTablesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTablesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableTablesRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs index 80ed56e4796ce..e57261f307d9d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs @@ -33,7 +33,7 @@ public ServiceRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs index f8bea3d172d40..1e4130ce83207 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs @@ -33,7 +33,7 @@ public SqlResourcesRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs index 0ace58f3fc9ec..555b3290ccf7b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs @@ -33,7 +33,7 @@ public TableResourcesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md index 9703f1ce489b4..7fe0fe87ac8ea 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md @@ -9,13 +9,18 @@ azure-arm: true csharp: true library-name: CosmosDB namespace: Azure.ResourceManager.CosmosDB -require: https://github.com/Azure/azure-rest-api-specs/blob/44e83346defd3d4ca99efade8b1ee90c67d9f249/specification/cosmos-db/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/fa285f544fa37cd839c4befe1109db3547b016ab/specification/cosmos-db/resource-manager/readme.md +#tag: package-preview-2023-09 output-folder: $(this-folder)/Generated clear-output-folder: true +sample-gen: + output-folder: $(this-folder)/../samples/Generated + clear-output-folder: true skip-csproj: true modelerfour: flatten-payloads: false lenient-model-deduplication: true + # mgmt-debug: # show-serialized-names: true @@ -129,13 +134,10 @@ rename-mapping: Role: MongoDBRole Role.db: DBName MongoRoleDefinitionGetResults.properties.type: RoleDefinitionType - PrivilegeResourceInfo: PrivilegeResourceInfoResource MongoRoleDefinitionListResult: MongoDBRoleDefinitionListResult MongoUserDefinitionListResult: MongoDBUserDefinitionListResult - SqlRoleDefinitionResource: CosmosDBSqlRoleDefinitionResourceInfo CassandraKeyspacePropertiesOptions: CassandraKeyspacePropertiesConfig CassandraTablePropertiesOptions: CassandraTablePropertiesConfig - CosmosTablePropertiesOptions: CosmosDBTablePropertiesConfig CreateUpdateOptions: CosmosDBCreateUpdateConfig GremlinDatabasePropertiesOptions: GremlinDatabasePropertiesConfig GremlinGraphPropertiesOptions: GremlinGraphPropertiesConfig @@ -149,7 +151,6 @@ rename-mapping: CassandraKeyspaceResource: CassandraKeyspaceResourceInfo CassandraTablePropertiesResource: ExtendedCassandraTableResourceInfo CassandraTableResource: CassandraTableResourceInfo - CosmosTablePropertiesResource: ExtendedCosmosTableResourceInfo ClientEncryptionKeyGetPropertiesResource: CosmosDBSqlClientEncryptionKeyProperties ClientEncryptionKeyResource: CosmosDBSqlClientEncryptionKeyResourceInfo ClientEncryptionPolicy: CosmosDBClientEncryptionPolicy @@ -177,11 +178,9 @@ rename-mapping: CosmosDBSqlContainerPropertiesResource: ExtendedCosmosDBSqlContainerResourceInfo SqlContainerResource: CosmosDBSqlContainerResourceInfo SqlDatabaseResource: CosmosDBSqlDatabaseResourceInfo - SqlStoredProcedurePropertiesResource: ExtendedCosmosDBSqlStoredProcedureResourceInfo SqlStoredProcedureResource: CosmosDBSqlStoredProcedureResourceInfo SqlTriggerResource: CosmosDBSqlTriggerResourceInfo CosmosDBSqlTriggerPropertiesResource: ExtendedCosmosDBSqlTriggerResourceInfo - SqlUserDefinedFunctionPropertiesResource: ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo SqlUserDefinedFunctionResource: CosmosDBSqlUserDefinedFunctionResourceInfo TableResource: CosmosDBTableResourceInfo ThroughputPolicyResource: ThroughputPolicyResourceInfo @@ -201,6 +200,7 @@ rename-mapping: ClusterResource: CassandraCluster ClusterKey: CassandraClusterKey ClusterResourceProperties: CassandraClusterProperties + ClusterType: CassandraClusterType DataCenterResource: CassandraDataCenter DataCenterResourceProperties: CassandraDataCenterProperties ListDataCenters: CassandraDataCenterListResult @@ -300,7 +300,9 @@ rename-mapping: PrivilegeResource: MongoDBPrivilegeResourceInfo PrivilegeResource.db: DBName MinimalTlsVersion: CosmosDBMinimalTlsVersion - BackupResource: CassandraClusterBackupResource + BackupResource: CassandraClusterBackupResourceInfo + BackupSchedule: CassandraClusterBackupSchedule + BackupState: CassandraClusterBackupState CheckNameAvailabilityRequest: CheckCosmosDBNameAvailabilityContent CheckNameAvailabilityResponse: CheckCosmosDBNameAvailabilityResponse CheckNameAvailabilityReason: CosmosDBNameUnavailableReason @@ -332,7 +334,6 @@ prepend-rp-prefix: - FailoverPolicies - FailoverPolicy - BackupInformation -- ContainerPartitionKey - CompositePath - PartitionKind - PercentileMetric diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraKeyspaceTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraKeyspaceTests.cs index 3568fb545f046..8b9353e950336 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraKeyspaceTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraKeyspaceTests.cs @@ -118,7 +118,7 @@ public async Task CassandraKeyspaceThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CassandraKeyspaceThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraTableTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraTableTests.cs index 1e66488b406dc..cca003cc75683 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraTableTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraTableTests.cs @@ -119,7 +119,7 @@ public async Task CassandraTableThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CassandraTableThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableOperationTests.cs index c6130b896a401..e1c8caa596e36 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableOperationTests.cs @@ -118,13 +118,13 @@ public async Task TableRestoreTest() var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); var restorableDatabaseAccount = restorableAccounts.SingleOrDefault(account => account.Data.AccountName == _databaseAccount.Data.Name); DateTimeOffset timestampInUtc = DateTimeOffset.FromUnixTimeSeconds((int)table.Data.Resource.Timestamp.Value); - AddDelayInSeconds(60); + AddDelayInSeconds(180); String restoreSource = restorableDatabaseAccount.Id; ResourceRestoreParameters RestoreParameters = new ResourceRestoreParameters { RestoreSource = restoreSource, - RestoreTimestampInUtc = timestampInUtc.AddSeconds(60) + RestoreTimestampInUtc = timestampInUtc.AddSeconds(100) }; await table.DeleteAsync(WaitUntil.Completed); @@ -177,7 +177,7 @@ public async Task TableThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CosmosTableThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableTests.cs index 45639174059a4..2b67eb4472709 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableTests.cs @@ -119,7 +119,7 @@ public async Task TableThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CosmosTableThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountOperationsTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountOperationsTests.cs index 850590dcc16e1..2ae192cdbbde5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountOperationsTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountOperationsTests.cs @@ -233,6 +233,7 @@ private void VerifyCosmosDBAccount(CosmosDBAccountResource expectedValue, Cosmos Assert.AreEqual(expectedValue.ConnectorOffer, actualValue.ConnectorOffer); Assert.AreEqual(expectedValue.DisableKeyBasedMetadataWriteAccess, actualValue.DisableKeyBasedMetadataWriteAccess); Assert.AreEqual(expectedValue.KeyVaultKeyUri, actualValue.KeyVaultKeyUri); + Assert.AreEqual(expectedValue.CustomerManagedKeyStatus, actualValue.CustomerManagedKeyStatus); Assert.AreEqual(expectedValue.PublicNetworkAccess, actualValue.PublicNetworkAccess); Assert.AreEqual(expectedValue.EnableFreeTier, actualValue.EnableFreeTier); Assert.AreEqual(expectedValue.ApiProperties.ServerVersion.ToString(), actualValue.ApiProperties.ServerVersion.ToString()); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountTests.cs index 9eff3f9ab3b40..2892e83acf90d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountTests.cs @@ -61,6 +61,8 @@ public async Task DatabaseAccountCreateAndUpdateTest() EnableAutomaticFailover = true, DisableKeyBasedMetadataWriteAccess = true, EnableBurstCapacity = true, + EnablePriorityBasedExecution = true, + DefaultPriorityLevel = DefaultPriorityLevel.Low, }; updateOptions.Tags.Add("key3", "value3"); updateOptions.Tags.Add("key4", "value4"); @@ -227,12 +229,15 @@ private void VerifyCosmosDBAccount(CosmosDBAccountResource expectedValue, Cosmos Assert.AreEqual(expectedData.ConnectorOffer, actualData.ConnectorOffer); Assert.AreEqual(expectedData.DisableKeyBasedMetadataWriteAccess, actualData.DisableKeyBasedMetadataWriteAccess); Assert.AreEqual(expectedData.KeyVaultKeyUri, actualData.KeyVaultKeyUri); + Assert.AreEqual(expectedData.CustomerManagedKeyStatus, actualData.CustomerManagedKeyStatus); Assert.AreEqual(expectedData.PublicNetworkAccess, actualData.PublicNetworkAccess); Assert.AreEqual(expectedData.IsFreeTierEnabled, actualData.IsFreeTierEnabled); Assert.AreEqual(expectedData.ApiProperties.ServerVersion.ToString(), actualData.ApiProperties.ServerVersion.ToString()); Assert.AreEqual(expectedData.IsAnalyticalStorageEnabled, actualData.IsAnalyticalStorageEnabled); Assert.AreEqual(expectedData.Cors.Count, actualData.Cors.Count); Assert.AreEqual(expectedData.EnableBurstCapacity, actualData.EnableBurstCapacity); + Assert.AreEqual(expectedData.EnablePriorityBasedExecution, actualData.EnablePriorityBasedExecution); + Assert.AreEqual(expectedData.DefaultPriorityLevel, actualData.DefaultPriorityLevel); } private void VerifyCosmosDBAccount(CosmosDBAccountResource databaseAccount, CosmosDBAccountPatch parameters) @@ -242,6 +247,8 @@ private void VerifyCosmosDBAccount(CosmosDBAccountResource databaseAccount, Cosm Assert.AreEqual(databaseAccount.Data.EnableAutomaticFailover, parameters.EnableAutomaticFailover); Assert.AreEqual(databaseAccount.Data.DisableKeyBasedMetadataWriteAccess, parameters.DisableKeyBasedMetadataWriteAccess); Assert.AreEqual(databaseAccount.Data.EnableBurstCapacity, parameters.EnableBurstCapacity); + Assert.AreEqual(databaseAccount.Data.EnablePriorityBasedExecution, parameters.EnablePriorityBasedExecution); + Assert.AreEqual(databaseAccount.Data.DefaultPriorityLevel, parameters.DefaultPriorityLevel); } private void VerifyLocations(IReadOnlyList expectedData, IReadOnlyList actualData) diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseOperationTests.cs index fd8b616937520..cd86545a3d086 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseOperationTests.cs @@ -112,13 +112,13 @@ public async Task GremlinDatabaseRestoreTest() var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); var restorableDatabaseAccount = restorableAccounts.SingleOrDefault(account => account.Data.AccountName == _databaseAccount.Data.Name); DateTimeOffset timestampInUtc = DateTimeOffset.FromUnixTimeSeconds((int)database.Data.Resource.Timestamp.Value); - AddDelayInSeconds(60); + AddDelayInSeconds(180); String restoreSource = restorableDatabaseAccount.Id; ResourceRestoreParameters RestoreParameters = new ResourceRestoreParameters { RestoreSource = restoreSource, - RestoreTimestampInUtc = timestampInUtc.AddSeconds(60) + RestoreTimestampInUtc = timestampInUtc.AddSeconds(100) }; await database.DeleteAsync(WaitUntil.Completed); @@ -169,7 +169,7 @@ public async Task GremlinDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); GremlinDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseTests.cs index 9671596826562..d999b30fe57d2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseTests.cs @@ -115,7 +115,7 @@ public async Task GremlinDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); GremlinDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphOperationTests.cs index 2885b6996cf38..b36965c66d8b1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphOperationTests.cs @@ -121,13 +121,13 @@ public async Task GremlinGraphRestoreTest() var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); var restorableDatabaseAccount = restorableAccounts.SingleOrDefault(account => account.Data.AccountName == _databaseAccount.Data.Name); DateTimeOffset timestampInUtc = DateTimeOffset.FromUnixTimeSeconds((int)graph.Data.Resource.Timestamp.Value); - AddDelayInSeconds(60); + AddDelayInSeconds(180); String restoreSource = restorableDatabaseAccount.Id; ResourceRestoreParameters RestoreParameters = new ResourceRestoreParameters { RestoreSource = restoreSource, - RestoreTimestampInUtc = timestampInUtc.AddSeconds(60) + RestoreTimestampInUtc = timestampInUtc.AddSeconds(100) }; await graph.DeleteAsync(WaitUntil.Completed); @@ -173,7 +173,7 @@ public async Task GremlinGraphThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); GremlinGraphThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphTests.cs index edc704e0438fe..57994c207a2a5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphTests.cs @@ -119,7 +119,7 @@ public async Task GremlinGraphThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); GremlinGraphThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionOperationTests.cs index 4ce8cd6a32698..60d1353083f16 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionOperationTests.cs @@ -171,7 +171,7 @@ public async Task MongoDBCollectionThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); MongoDBCollectionThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionTests.cs index 178f3d9413c2b..8b9f3aec962f5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionTests.cs @@ -113,7 +113,7 @@ public async Task MongoDBCollectionThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); MongoDBCollectionThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseOperationTests.cs index a700cfdd6440c..7aaf269135a10 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseOperationTests.cs @@ -174,7 +174,7 @@ public async Task MongoDBDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); MongoDBDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseTests.cs index 8bca0bd132f5e..ac307da576f63 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseTests.cs @@ -113,7 +113,7 @@ public async Task MongoDBDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); MongoDBDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/RestorableDatabaseAccountTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/RestorableDatabaseAccountTests.cs index f902be09a9728..cdbe0c050198e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/RestorableDatabaseAccountTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/RestorableDatabaseAccountTests.cs @@ -59,8 +59,23 @@ public async Task TearDown() public async Task RestorableDatabaseAccountList() { _restorableDatabaseAccount = await CreateRestorableDatabaseAccount(Recording.GenerateAssetName("r-database-account-"), CosmosDBAccountKind.GlobalDocumentDB, AzureLocation.WestUS); - var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); - Assert.That(restorableAccounts.Any(account => account.Data.AccountName == _restorableDatabaseAccount.Data.Name)); + await VerifyRestorableDatabaseAccount(_restorableDatabaseAccount.Data.Name); + } + + [Test] + [RecordedTest] + public async Task RestorableDatabaseAccountListWithContinuous7Account() + { + _restorableDatabaseAccount = await CreateRestorableDatabaseAccount(Recording.GenerateAssetName("r-database-account-"), CosmosDBAccountKind.GlobalDocumentDB, AzureLocation.WestUS, continuousTier: ContinuousTier.Continuous7Days); + await VerifyRestorableDatabaseAccount(_restorableDatabaseAccount.Data.Name); + } + + [Test] + [RecordedTest] + public async Task RestorableDatabaseAccountListWithContinuous30Account() + { + _restorableDatabaseAccount = await CreateRestorableDatabaseAccount(Recording.GenerateAssetName("r-database-account-"), CosmosDBAccountKind.GlobalDocumentDB, AzureLocation.WestUS, continuousTier: ContinuousTier.Continuous30Days); + await VerifyRestorableDatabaseAccount(_restorableDatabaseAccount.Data.Name); } [Test] @@ -104,13 +119,31 @@ public async Task RestoreSqlDatabaseAccount() } // TODO: more tests after fixing the code generation issue - protected async Task CreateRestorableDatabaseAccount(string name, CosmosDBAccountKind kind, AzureLocation location, bool isFreeTierEnabled = false, List capabilities = null, string apiVersion = null) + protected async Task CreateRestorableDatabaseAccount(string name, CosmosDBAccountKind kind, AzureLocation location, bool isFreeTierEnabled = false, List capabilities = null, string apiVersion = null, ContinuousTier? continuousTier = null) { var locations = new List() { new CosmosDBAccountLocation(id: null, locationName: location, documentEndpoint: null, provisioningState: null, failoverPriority: 0, isZoneRedundant: false) }; + CosmosDBAccountBackupPolicy backupPolicy; + ContinuousTier inputContinuousTier; + + if (continuousTier.HasValue) + { + inputContinuousTier = continuousTier.Value; + + backupPolicy = new ContinuousModeBackupPolicy + { + ContinuousModeProperties = new ContinuousModeProperties { Tier = continuousTier.Value } + }; + } + else + { + inputContinuousTier = ContinuousTier.Continuous30Days; // if ContinuousTier is not provided, then it defaults to Continuous30Days + backupPolicy = new ContinuousModeBackupPolicy(); + } + var createOptions = new CosmosDBAccountCreateOrUpdateContent(location, locations) { Kind = kind, @@ -120,7 +153,7 @@ protected async Task CreateRestorableDatabaseAccount(st EnableAutomaticFailover = false, ConnectorOffer = ConnectorOffer.Small, DisableKeyBasedMetadataWriteAccess = false, - BackupPolicy = new ContinuousModeBackupPolicy(), + BackupPolicy = backupPolicy, IsFreeTierEnabled = isFreeTierEnabled, }; @@ -136,9 +169,24 @@ protected async Task CreateRestorableDatabaseAccount(st _databaseAccountName = name; var accountLro = await DatabaseAccountCollection.CreateOrUpdateAsync(WaitUntil.Completed, _databaseAccountName, createOptions); + + Assert.AreEqual(inputContinuousTier, ((ContinuousModeBackupPolicy)accountLro.Value.Data.BackupPolicy).ContinuousModeTier, "Unexpected ContinuousTier"); + return accountLro.Value; } + private async Task VerifyRestorableDatabaseAccount(string expectedRestorableDatabaseAccountName) + { + var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); + + RestorableCosmosDBAccountResource restorableDBA = restorableAccounts.Where(account => account.Data.AccountName == expectedRestorableDatabaseAccountName).Single(); + Assert.AreEqual(restorableDBA.Data.ApiType, CosmosDBApiType.Sql); + Assert.IsNotNull(restorableDBA.Data.CreatedOn); + Assert.IsNull(restorableDBA.Data.DeletedOn, $"Actual DeletedOn: {restorableDBA.Data.DeletedOn}"); + Assert.IsNotNull(restorableDBA.Data.OldestRestorableOn); + Assert.IsNotNull(restorableDBA.Data.RestorableLocations); + } + private async Task RestoreAndVerifyRestoredAccount(AccountType accountType, RestorableCosmosDBAccountResource restorableAccount, CosmosDBAccountRestoreParameters restoreParameters, AzureLocation location, AzureLocation armLocation, bool IsFreeTierEnabled = false) { CosmosDBAccountKind kind = CosmosDBAccountKind.GlobalDocumentDB; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseOperationTests.cs index 4de3eeb1c7d1f..1c196dbed5c68 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseOperationTests.cs @@ -107,7 +107,7 @@ public async Task SqlDatabaseRestoreTest() Assert.That(databases, Has.Count.EqualTo(1)); Assert.AreEqual(database.Data.Name, databases[0].Data.Name); DateTimeOffset timestampInUtc = DateTimeOffset.FromUnixTimeSeconds((int)database.Data.Resource.Timestamp.Value); - AddDelayInSeconds(60); + AddDelayInSeconds(180); var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); var restorableDatabaseAccount = restorableAccounts.SingleOrDefault(account => account.Data.AccountName == _databaseAccount.Data.Name); @@ -120,7 +120,7 @@ public async Task SqlDatabaseRestoreTest() ResourceRestoreParameters RestoreParameters = new ResourceRestoreParameters { RestoreSource = restoreSource, - RestoreTimestampInUtc = timestampInUtc.AddSeconds(60) + RestoreTimestampInUtc = timestampInUtc.AddSeconds(100) }; CosmosDBSqlDatabaseResourceInfo resource = new CosmosDBSqlDatabaseResourceInfo(_databaseName, RestoreParameters, CosmosDBAccountCreateMode.Restore); @@ -165,7 +165,7 @@ public async Task SqlDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CosmosDBSqlDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseTests.cs index 034732a638300..f55d31f0e9bff 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseTests.cs @@ -112,7 +112,7 @@ public async Task SqlDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CosmosDBSqlDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlPartitionMergeTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlPartitionMergeTests.cs index be66996c303d6..0d1addf0d965b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlPartitionMergeTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlPartitionMergeTests.cs @@ -77,7 +77,7 @@ public async Task SqlDatabasePartitionMerge() ThroughputSettingData throughputData = (await throughput.MigrateSqlDatabaseToManualThroughputAsync(WaitUntil.Completed)).Value.Data; throughput = await database.GetCosmosDBSqlDatabaseThroughputSetting().GetAsync(); CosmosDBSqlDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(1000, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(1000, null, null, null, null, null)))).Value; MergeParameters mergeParameters = new MergeParameters() { IsDryRun = true }; try