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

[keyvault-secrets] Migrate to TypeSpec #31848

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maorleger
Copy link
Member

@maorleger maorleger commented Nov 19, 2024

-### Packages impacted by this PR

@azure/keyvault-secrets

Issues associated with this PR

Describe the problem that is addressed by this PR

What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?

Are there test cases added in this PR? (If not, why?)

Provide a list of related PRs (if any)

Command used to generate this PR: (Applicable only to SDK release request PRs)

Checklists

  • Added impacted package name to the issue description.
  • Does this PR need any fixes in the SDK Generator?** (If so, create an Issue in the Autorest/typescript repository and link it here.)
  • Added a changelog (if necessary).

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@maorleger maorleger marked this pull request as ready for review November 20, 2024 21:34
@maorleger maorleger requested review from bterlson, a team and timovv as code owners November 20, 2024 21:34
@@ -0,0 +1,86 @@
#!/usr/bin/env node

const { execSync } = require("child_process");
Copy link
Member Author

Choose a reason for hiding this comment

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

The end result is that this file should be deleted once all the workarounds are no longer needed

Copy link
Member

Choose a reason for hiding this comment

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

Should we have this at the top level? Or should we have one per package (in case there are package-specific things which need to be done, generating from a specific package's spec, etc)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I can move it inside the package folder. My hope (and so far that's been the case) is that the same set of customizations need to happen for all packages. I figured if they start diverging I can push them down into the individual package folder. But my real hope is that this script gets deleted by end of January as its a workaround, not a solution.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah if there are no differences between packages no problem with just keeping the script here. Whatever is least work for you.

)
.replace(
/nbf: !item\["notBefore"\] \? item\["notBefore"\] : item\["notBefore"\].getTime\(\),/g,
'nbf: !item["notBefore"] ? item["notBefore"] : item["notBefore"].getTime() / 1000,'
Copy link
Member

Choose a reason for hiding this comment

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

May want to truncate the decimal here

}
}
return mapPagedAsyncIterable(
this.client.getSecretVersions(secretName, options),
Copy link
Member

Choose a reason for hiding this comment

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

Random thought, do we know if maxPageSize works here? It's not defined on PageOptions in the generated code so am wondering if the property is now being ignored.

Cc @MaryGao

Copy link
Member

@MaryGao MaryGao Nov 22, 2024

Choose a reason for hiding this comment

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

maxPageSize is no longer support as a general option and we update the guideline also here.

@deyaaeldeen @xirzec I was wondering if we need to provide a standard way to expose this parameter for services still needing this option: https://github.com/search?q=repo%3AAzure%2Fazure-sdk-for-js+maxPageSize+language%3ATypeScript+samples-dev&type=code.

Copy link
Member

Choose a reason for hiding this comment

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

In the mean time for Key Vault perhaps we can customize the paging helpers to accept maxPageSize and pass it as maxresults like Key Vault is expecting? I'm not sure what kind of effort would be needed for that

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, let me investigate this here: Azure/autorest.typescript#2802.

Copy link
Member

Choose a reason for hiding this comment

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

@maorleger we discussed this internally and I could work with for paginate helper to support maxPageSize if breaking is not acceptable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you, I replied in the issue Azure/autorest.typescript#2802 (comment) and think we want to continue supporting maxPageSize in keyvault 🙏

@@ -0,0 +1,86 @@
#!/usr/bin/env node

const { execSync } = require("child_process");
Copy link
Member

Choose a reason for hiding this comment

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

Should we have this at the top level? Or should we have one per package (in case there are package-specific things which need to be done, generating from a specific package's spec, etc)?

Copy link
Member

@timovv timovv left a comment

Choose a reason for hiding this comment

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

LGTM. I see CI failures, but unsure what the cause is, since it looks like the build got deleted. Assuming those can be fixed I don't see any issues other than the maxPageSize we've already talked about


// The authentication policy must come after the deserialization policy since the deserialization policy
// converts 401 responses to an Error, and we don't want to deal with that.
this.client.pipeline.removePolicy({ name: bearerTokenAuthenticationPolicyName });
this.client.pipeline.addPolicy(keyVaultAuthenticationPolicy(credential, pipelineOptions), {
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as certs, we don't need to place this after deserializationPolicy anymore since it no longer exists

@maorleger maorleger force-pushed the keyvault-secrets-typespec branch 2 times, most recently from 05d2065 to 98658f7 Compare December 10, 2024 22:58
@maorleger maorleger force-pushed the keyvault-secrets-typespec branch from 98658f7 to 8c01e6f Compare December 10, 2024 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Untriaged
Development

Successfully merging this pull request may close these issues.

4 participants