Skip to content

Updating getobjectsbyobjectId call for objectIds > 1000 #4002

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

Merged
merged 8 commits into from
May 30, 2017

Conversation

darshanhs90
Copy link
Contributor

@darshanhs90 darshanhs90 commented May 19, 2017

Description

Updating getobjectsbyobjectId call for objectIds > 1000,since they API limits only 1000 objectIds


This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.

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.
  • The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.

Cmdlet Signature Guidelines

  • New cmdlets that make changes or have side effects should implement ShouldProcess and have SupportShouldProcess=true specified in the cmdlet attribute. You can find more information on ShouldProcess here.
  • Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThru parameter.

Cmdlet Parameter Guidelines

  • Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
  • Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.

for(int i=0; i<objectIds.Count; i+=1000)
{
if((i+1000) > objectIds.Count){
adObjects = GraphClient.Objects.GetObjectsByObjectIds(new GetObjectsParameters { ObjectIds = objectIds.GetRange(i, objectIds.Count - i), IncludeDirectoryObjectReferences = true });
Copy link
Contributor

@wisexp wisexp May 19, 2017

Choose a reason for hiding this comment

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

objectIds.Count - i [](start = 135, length = 19)

compute the end index in "if-else" block then merge two graph calls into one line #Resolved

var adObjects = GraphClient.Objects.GetObjectsByObjectIds(new GetObjectsParameters { ObjectIds = objectIds, IncludeDirectoryObjectReferences = true });
result.AddRange(adObjects.Select(o => o.ToPSADObject()));
IPage<AADObject> adObjects;
for(int i=0; i<objectIds.Count; i+=1000)
Copy link
Contributor

@wisexp wisexp May 19, 2017

Choose a reason for hiding this comment

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

1000 [](start = 47, length = 4)

it will be better to write a comment that graph only supports up to 1000 ids. #Resolved

"FxVersion/4.7.2046.0",
"OSName/Windows_10_Enterprise",
"OSVersion/6.3.15063",
"Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0-preview"
Copy link
Contributor

@wisexp wisexp May 19, 2017

Choose a reason for hiding this comment

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

entClient/1.6.0-preview [](start = 69, length = 23)

are these stuff related to your change? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just ran the other test cases to make sure they still work in record mode since the session records had become stale( as the test cases were ran almost a year back)


In reply to: 117386585 [](ancestors = 117386585)

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 it's better to update them in a separate PR for tracking purpose.


In reply to: 117542183 [](ancestors = 117542183,117386585)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reverted the extra ones


In reply to: 117567000 [](ancestors = 117567000,117542183,117386585)

@wisexp
Copy link
Contributor

wisexp commented May 19, 2017

:shipit:

@darshanhs90 darshanhs90 requested a review from shahabhijeet May 19, 2017 22:53
@darshanhs90
Copy link
Contributor Author

@shahabhijeet Is there anything blocking from my side for the pr to be merged?

Copy link
Member

@markcowl markcowl left a comment

Choose a reason for hiding this comment

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

This looks food. Please add a description of this change (what behavior was changed from a customer perspective) to the changelog for the resource manager cmdlets

@markcowl markcowl removed the request for review from shahabhijeet May 24, 2017 00:39
@markcowl
Copy link
Member

@darshanhs90
Copy link
Contributor Author

@markcowl The signing run is failing for 'Stop-AzureStorageBlobCopy' return type 'AzureStorageBlob'."
ERROR - System.InvalidOperationException: One or more errors occurred in validation. See the analysis repots at D:\workspace\powershell-sign\src\Package for details at StaticAnalysis.AnalysisLogger.CheckForIssues(Int32 maxSeverity) in D:\workspace\powershell-sign\tools\StaticAnalysis\Loggers\AnalysisLogger.cs:line 185

do let me know no what can be done to get this PR merged

@markcowl
Copy link
Member

@darshanhs90 This is failing due to reports of breaking change issues. Most likely this means you are not up to date with the preview branch. Please pull the latest from the preview branch and push to your fork.

@darshanhs90
Copy link
Contributor Author

@markcowl updated the code with the latest code from the upstream

@markcowl
Copy link
Member

@darshanhs90
Copy link
Contributor Author

the ondemand run passed,however the signing run failed again even after i restarted it
http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-sign/1083/

@markcowl markcowl merged commit 47eb780 into Azure:preview May 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants