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

Generate SDK.Net from swagger 'SQL database, elastic pool, and capabilities 2017-10-01-preview', and re-recording all Sql tests #4171

Merged
merged 12 commits into from
Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SDKs/SqlManagement/AzSdk.RP.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--This file and it's contents are updated at build time moving or editing might result in build failure. Take due deligence while editing this file-->
<PropertyGroup>
<AzureApiTag>Sql_2017-03-01-preview;Sql_2014-04-01;Sql_2015-05-01-preview;Sql_2017-10-01-preview;</AzureApiTag>
<AzureApiTag>Sql_2017-03-01-preview;Sql_2017-10-01-preview;Sql_2014-04-01;Sql_2015-05-01-preview;</AzureApiTag>
<PackageTags>$(PackageTags);$(CommonTags);$(AzureApiTag);</PackageTags>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.

namespace Microsoft.Azure.Management.Sql.Models
{
using System;
using System.Linq;
using Newtonsoft.Json;

public partial class Database : TrackedResource
{
/// <summary>
/// Gets the edition of the database. If createMode is OnlineSecondary, this value is
/// ignored.To see possible values, query the capabilities API
/// (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities)
/// referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI
/// command az sql db list-editions -l westus --query[].name. Possible values include:
/// 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch',
/// 'DataWarehouse', 'System', 'System2'
/// </summary>
[JsonIgnore]
public string Edition
{
get
{
return Sku?.Tier;
}
}

/// <summary>
/// Gets the current service level objective of the database.
/// </summary>
[JsonIgnore]
public string ServiceLevelObjective
{
get
{
return CurrentServiceObjectiveName;
}
}

/// <summary>
/// Gets the name of the elastic pool the database is in. If elasticPoolName and
/// requestedServiceObjectiveName are both updated, the value of
/// requestedServiceObjectiveName is ignored. Not supported for DataWarehouse
/// edition.
/// </summary>
[JsonIgnore]
public string ElasticPoolName
{
get
{
return ResourceIdHelpers.GetLastSegment(ElasticPoolId);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.

namespace Microsoft.Azure.Management.Sql.Models
{
using System;
using System.Linq;
using Newtonsoft.Json;

public partial class DatabaseUpdate : TrackedResource
{
/// <summary>
/// Gets the edition of the database. If createMode is OnlineSecondary, this value is
/// ignored.To see possible values, query the capabilities API
/// (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities)
/// referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI
/// command az sql db list-editions -l westus --query[].name. Possible values include:
/// 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch',
/// 'DataWarehouse', 'System', 'System2'
/// </summary>
public string Edition
{
get
{
return Sku?.Tier;
}
}

/// <summary>
/// Gets the current service level objective of the database.
/// </summary>
public string ServiceLevelObjective
{
get
{
return CurrentServiceObjectiveName;
}
}

/// <summary>
/// Gets the name of the elastic pool the database is in. If elasticPoolName and
/// requestedServiceObjectiveName are both updated, the value of
/// requestedServiceObjectiveName is ignored. Not supported for DataWarehouse
/// edition.
/// </summary>
public string ElasticPoolName
{
get
{
return ResourceIdHelpers.GetLastSegment(ElasticPoolId);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.

namespace Microsoft.Azure.Management.Sql.Models
{
using System;
using System.Linq;
using Newtonsoft.Json;

public partial class ElasticPool : TrackedResource
{
/// <summary>
/// Gets or sets the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'
/// </summary>
public string Edition
{
get
{
return Sku?.Tier;
}
}

/// <summary>
/// Gets the total shared DTU for the database elastic pool.
/// </summary>
public int? Dtu
{
get
{
return Sku?.Capacity;
}
}

/// <summary>
/// Gets storage limit for the database elastic pool in MB.
/// </summary>
public int? StorageMB
{
get
{
if (MaxSizeBytes == null)
{
return null;
}

return (int)(MaxSizeBytes / 1024 / 1024);
}
set
{
MaxSizeBytes = value * 1024 * 1024;
}
}

/// <summary>
/// Gets or sets the minimum DTU all databases are guaranteed.
/// </summary>
[JsonIgnore]
public int? DatabaseDtuMin
{
get
{
return (int?)PerDatabaseSettings?.MinCapacity;
}
set
{
if (PerDatabaseSettings == null)
{
PerDatabaseSettings = new ElasticPoolPerDatabaseSettings();
}

PerDatabaseSettings.MinCapacity = value;
}
}

/// <summary>
/// Gets or sets the maximum DTU any one database can consume.
/// </summary>
[JsonIgnore]
public int? DatabaseDtuMax
{
get
{
return (int?)PerDatabaseSettings?.MaxCapacity;
}
set
{
if (PerDatabaseSettings == null)
{
PerDatabaseSettings = new ElasticPoolPerDatabaseSettings();
}

PerDatabaseSettings.MaxCapacity = value;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.

namespace Microsoft.Azure.Management.Sql.Models
{
using System;
using System.Linq;
using Newtonsoft.Json;

public partial class ElasticPoolUpdate : TrackedResource
{
/// <summary>
/// Gets or sets the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'
/// </summary>
public string Edition
{
get
{
return Sku?.Tier;
}
}

/// <summary>
/// Gets the total shared DTU for the database elastic pool.
/// </summary>
public int? Dtu
{
get
{
return Sku?.Capacity;
}
}

/// <summary>
/// Gets storage limit for the database elastic pool in MB.
/// </summary>
public int? StorageMB
{
get
{
if (MaxSizeBytes == null)
{
return null;
}

return (int)(MaxSizeBytes / 1024 / 1024);
}
set
{
MaxSizeBytes = value * 1024 * 1024;
}
}

/// <summary>
/// Gets or sets the minimum DTU all databases are guaranteed.
/// </summary>
[JsonIgnore]
public int? DatabaseDtuMin
{
get
{
return (int?)PerDatabaseSettings?.MinCapacity;
}
set
{
if (PerDatabaseSettings == null)
{
PerDatabaseSettings = new ElasticPoolPerDatabaseSettings();
}

PerDatabaseSettings.MinCapacity = value;
}
}

/// <summary>
/// Gets or sets the maximum DTU any one database can consume.
/// </summary>
[JsonIgnore]
public int? DatabaseDtuMax
{
get
{
return (int?)PerDatabaseSettings?.MaxCapacity;
}
set
{
if (PerDatabaseSettings == null)
{
PerDatabaseSettings = new ElasticPoolPerDatabaseSettings();
}

PerDatabaseSettings.MaxCapacity = value;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.

namespace Microsoft.Azure.Management.Sql
{
using System;
using System.Linq;

/// <summary>
/// Helpers methods for working with resource ids.
/// </summary>
internal static class ResourceIdHelpers
{
/// <summary>
/// Gets the last segments of a resource id, or null if the id is null.
/// </summary>
/// <param name="resourceId">The resource id.</param>
public static string GetLastSegment(string resourceId)
{
if (resourceId == null)
{
return null;
}

// Uri.Segments is only supported for absolute uris, so we give
// a fake host name.
Uri uri = new Uri(
new Uri("https://my.example"), // Dummy host name
resourceId);

return uri.Segments.Last();
}
}
}
Loading