Skip to content

Conversation

@johnpaulkee
Copy link
Contributor

@johnpaulkee johnpaulkee commented May 18, 2018

Description

This is a preview SDK for the new SQL Database Agent introduced in the 2017-03-01 preview API version.
Added the corresponding tests. Pull request for Swagger: Azure/azure-rest-api-specs#2909


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

SDK Generation Guidelines

  • If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
  • The generate.cmd file for the SDK has been updated with the version of AutoRest, as well as the commitid of your swagger spec or link to the swagger spec, used to generate the code.
  • The *.csproj and AssemblyInfo.cs files have been updated with the new version of the SDK.

@johnpaulkee
Copy link
Contributor Author

johnpaulkee commented May 18, 2018

@jaredmoo Initial pass at the SQL Database Agent .NET SDK PR is set up.

Copy link
Contributor

@jaredmoo jaredmoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also bump version (latest published is 1.15.0 as you can see at https://www.nuget.org/packages/Microsoft.Azure.Management.Sql , so bump to 1.16.0) & update release notes in Microsoft.Azure.Management.Sql.csproj. And bump version in AssemblyInfo.cs.

// TEST_CSM_ORGID_AUTHENTICATION environment variable in this format then:
// SubscriptionId={SubId};ServicePrincipal={clientId};ServicePrincipalSecret={clientSecret};AADTenant={tenantId};Environment={env};HttpRecorderMode=Record;
// The below string split and getting the {SubId} should work.
this._subscriptionId = Environment.GetEnvironmentVariables()["TEST_CSM_ORGID_AUTHENTICATION"].ToString().Split(';')[0].Split('=')[1];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this won't work in test playback, but you can use sqlManagementClient.SubscriptionId instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't need it since we can just use credential.Id and targetGroup.Id :)

JobCredential credential = sqlClient.JobCredentials.CreateOrUpdate(resourceGroup.Name, server.Name, agent.Name, SqlManagementTestUtilities.DefaultLogin, new JobCredential
{
Username = "cloudsa",
Password = "Yukon900!"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use

                Username = SqlManagementTestUtilities.DefaultLogin,
                Password = SqlManagementTestUtilities.DefaultPassword,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, you update below. Can you make this initial credential more fake looking, like just "a" and "b"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

{
ServerName = "s1",
Type = JobTargetType.SqlServer,
RefreshCredential = FormatCredentialId(resourceGroup.Name, server.Name, agent.Name, credential.Name),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just used credential.Id ;)

});



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: excessive whitespace?

{
Value = "SELECT 1"
},
TargetGroup = FormatTargetGroupId(resourceGroup.Name, server.Name, agent.Name, targetGroup.Name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

targetGroup.Id

@jaredmoo
Copy link
Contributor

Note to SDK team: we also have another SQL feature #4327 coming in at the same time, we will make sure to coordinate between these 2 features. Most likely we can get them completed and published together in the next few days.

* ElasticPool.PerDatabaseSettings has replaced ElasticPool.DatabaseDtuMin and ElasticPool.DatabaseDtuMax.
- Database.MaxSizeBytes is now a long instead of string.
- LocationCapabilities tree has been changed in order to support capabilities of new vCore-based database and elastic pool editions.
- Adding support for SQL Database Agent
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaredmoo Is this new features description too plain? Let me know if you'd like a more detailed one.
I was unsure how detailed to go for a release update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is totally fine. Maybe also mention the type names (JobAgent, Job, JobStep, ....) so that it is obvious which types are related to DB agent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update.

Copy link
Contributor

@dsgouda dsgouda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run msbuild build.proj /t:build /p:Scope=SDs\SqlManagement and commit any changes to the .props file

Branch: master
Commit: d08c7f54a125819caaa8c5f553206d1adbae60f9
GitHub user: johnpaulkee
Branch: jobsSdk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code MUST be generated from a spec in the Azure master branch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did this in order to isolate this change from other APIs added to readme.md at the same time.

It was just this change to readme: https://github.com/johnpaulkee/azure-rest-api-specs/commit/992e3dd8dfe722697d045458f827e9d554ef6ebb

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is a good strategy. Either create and use a tag in the config file to scope the files you'd like to generate the code for or we could create a whitelisted branch in the repo to coordinate the work before merging with psSdkJson6
@shahabhijeet can you lend some thoughts too?

…s ran msbuild build.proj /t:build /p:Scope=SDs\SqlManagement
@johnpaulkee
Copy link
Contributor Author

@dsgouda I've regenerated from azure master. Note that there will be some included generated SDKs for DatabaseVulnerabilityAssessment, VulnerabilityAssessment, and ShortTermRetentionPolicies that will be added too due to this. FYI @yaakoviyun @dealaus

@jaredmoo I heard from @dsgoudsa that it's fine to add the other SDKs as part of this PR since we can add tests to them later. let me know your thoughts on that.

@jaredmoo
Copy link
Contributor

It's fine to include the other features, but the risk to us is that @yaakoviyun & @dealaus will need to add tests before we can release.

@jaredmoo
Copy link
Contributor

This PR was merged into #4351 and can be closed,

@dsgouda dsgouda merged commit dbb8d11 into Azure:psSdkJson6 May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants