-
Notifications
You must be signed in to change notification settings - Fork 204
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
Dandua98/cosmos arm #116
Dandua98/cosmos arm #116
Conversation
userSubscriptionItem.subscriptionId === undefined | ||
) { | ||
throw new SubscriptionError( | ||
"SubscriptionItem cannot have undefined values" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix to move this to constants is in next PR
// See http://go.microsoft.com/fwlink/?LinkId=827846 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are by VSCode, not us
): ResourceManagementClient { | ||
let userCredentials: ServiceClientCredentials = | ||
userSubscriptionItem.session.credentials; | ||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is private method - you don't need to validate input. Instead you need to make sure that this method is called with correct parameters that are not null.
please remove line 27. And possibly entire "if" depends on if you explicitly want containment of the userSubscriptionItem.subscription(Id) to be validated in this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix for this is in next PR (#117) which uses this module too. I extended some functionality there so would rather address it there
|
||
public getResourceManagementClient( | ||
userSubscriptionItem: SubscriptionItem | ||
): ResourceManagementClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this one is public - check for null in the input parameters. If userSubscriptionItem is null -> don't call this.SetClientState. Instead either throw or whatever is expected result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okey for now, but please keep in mind for the future that not everything can be carried to the future PR's. "Missing null-check" is buggy enough to be fixed within the same PR. State of your main branch can't be broken between PR's because you decided to fix your previous PR in the next PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a missing null-check. It can't be null anyway (can only be undefined) and we're checking for that instead
{ | ||
"apiVersion": "2015-04-08", | ||
"kind": "[parameters('kind')]", | ||
"type": "Microsoft.DocumentDb/databaseAccounts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be Microsoft.DocumentDB/databaseAccounts
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, this is not decided by me. It's the parameters Azure accepts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.microsoft.com/en-us/azure/templates/Microsoft.DocumentDB/2015-04-08/databaseAccounts
Please fix this in the next PR since I realize you have conflicts.
}; | ||
|
||
try { | ||
if (this.SubscriptionItemCosmosClient === undefined) { | ||
throw new AuthorizationError("Cosmos Client cannot be undefined."); | ||
} | ||
|
||
let azureResourceClient: ResourceManagementClient = new ResourceManager().getResourceManagementClient( | ||
userSubscriptionItem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean "userSubscriptionItem"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a parameter to the, I just modified what gets done in this function (modifying how cosmos is deployed internally) and not function and class itself
WARNING: Don't review this PR until #115 is closed. This will reduce the number of changes shown
This PR introduces ARM templates for Cosmos and closes AB#24106
Testing Notes:
./build
followed by F5 in extension dir to run the extension) and deploy a cosmos resource through the wizardNotes: