Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest CosmosDB client libraray and allow ServerVersion to … #14235

Merged
merged 8 commits into from
Feb 23, 2021
1 change: 1 addition & 0 deletions src/CosmosDB/CosmosDB/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

## Upcoming Release
* Introduced NetworkAclBypass and NetworkAclBypassResourceIds for Database Account cmdlets.
* Introduced ServerVersion option to Update-AzCosmosDBAccount.
kavskalyan marked this conversation as resolved.
Show resolved Hide resolved

## Version 1.0.0
* General availability of 'Az.CosmosDB' module
Expand Down
4 changes: 0 additions & 4 deletions src/CosmosDB/CosmosDB/CosmosDBAccount/NewAzCosmosDBAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ public class NewAzCosmosDBAccount : NewOrUpdateAzCosmosDBAccount
[Parameter(Mandatory = false, HelpMessage = Constants.EnableFreeTierHelpMessage)]
public bool? EnableFreeTier { get; set; }

[Parameter(Mandatory = false, HelpMessage = Constants.ServerVersionHelpMessage)]
[PSArgumentCompleter(SDKModel.ServerVersion.ThreeFullStopTwo, SDKModel.ServerVersion.ThreeFullStopSix)]
public string ServerVersion { get; set; }

[Parameter(Mandatory = false, HelpMessage = Constants.LocationHelpMessage)]
[ValidateNotNullOrEmpty]
public string[] Location { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public class NewOrUpdateAzCosmosDBAccount : AzureCosmosDBCmdletBase
[ValidateNotNullOrEmpty]
public string[] NetworkAclBypassResourceId { get; set; }

[Parameter(Mandatory = false, HelpMessage = Constants.ServerVersionHelpMessage)]
[PSArgumentCompleter(SDKModel.ServerVersion.ThreeFullStopTwo, SDKModel.ServerVersion.ThreeFullStopSix, SDKModel.ServerVersion.FourFullStopZero)]
public string ServerVersion { get; set; }

public ConsistencyPolicy PopoulateConsistencyPolicy(string DefaultConsistencyLevel, int? MaxStalenessIntervalInSeconds, int? MaxStalenessPrefix)
{
ConsistencyPolicy consistencyPolicy = new ConsistencyPolicy();
Expand Down
10 changes: 10 additions & 0 deletions src/CosmosDB/CosmosDB/CosmosDBAccount/UpdateAzCosmosDBAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ public override void ExecuteCmdlet()
databaseAccountUpdateParameters.IpRules = base.PopulateIpRules(IpRule);
}

if (ServerVersion != null)
MehaKaushik marked this conversation as resolved.
Show resolved Hide resolved
{
if (databaseAccountUpdateParameters.ApiProperties == null)
{
databaseAccountUpdateParameters.ApiProperties = new ApiProperties();
}

databaseAccountUpdateParameters.ApiProperties.ServerVersion = ServerVersion;
}

if (NetworkAclBypassResourceId != null)
{
Collection<string> networkAclBypassResourceId = new Collection<string>(NetworkAclBypassResourceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public PSApiProperties(ApiProperties apiProperties)
//
// Summary:
// Gets or sets describes the ServerVersion of an a MongoDB account. Possible values
// include: '3.2', '3.6'
// include: '3.2', '3.6', '4.0'
public string ServerVersion { get; set; }
}
}