-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Added new cmdlets for flowLog resource #11193
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
Conversation
| { | ||
| base.Execute(); | ||
|
|
||
| if (ParameterSetName.Contains("SetByResourceId")) |
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 better to set ParameterSetName as const and use string equal to check the condition.
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.
done
| private void ValidateInput() | ||
| { | ||
| string[] splittedTargetResourceId = this.TargetResourceId.Split('/'); | ||
| if (splittedTargetResourceId.Count() < 9 || string.IsNullOrEmpty(splittedTargetResourceId[7]) || !splittedTargetResourceId[7].Equals("networkSecurityGroups", StringComparison.OrdinalIgnoreCase)) |
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.
9 and 7 seems a magic number. It's better to create a function handle the logic of spliting StorageResourceId.
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.
done
| return NetworkResourceManagerProfile.Mapper.Map<PSFlowLogResource>(flowLogResult); | ||
| } | ||
|
|
||
| private void ValidateInput() |
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.
This method is same with AddAzNetworkWatcherFlowLogCommand, you can move it into base class and reuse it.
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.
done
| string parent = flowLogInfo.ParentResource; | ||
| string[] tokens = parent.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); | ||
|
|
||
| this.NetworkWatcherName = tokens[1]; |
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.
What if tokens length is 0?
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.
added validation
|
Hi @irrogozh , could you please also add test case and help files for these cmdlets. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Added new cmdlets for flowLog resource
Description
Checklist
CONTRIBUTING.mdChangeLog.mdfile(s) has been updated:ChangeLog.mdfile can be found atsrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md## Upcoming Releaseheader -- no new version header should be added