Skip to content

Instantly share code, notes, and snippets.

View jianghaolu's full-sized avatar

Jianghao Lu jianghaolu

  • Microsoft
  • Redmond, WA
View GitHub Profile
fixtures.bodycomplex.implementation.models:
Goblinshark:
rename: GoblinShark
DotSalmon:
properties:
iswild:
rename: isWild
methods:
setIsWild:
rename: setWild
@jianghaolu
jianghaolu / autorest-java-customizations.md
Created August 19, 2020 02:33
AutoRest Java Customizations

Intro

There are primarily 3 places a user of AutoRest Java can customize the generated code:

  1. pre-gen

An example of this is transforms of Swagger docs. This is similar to modifying the Swagger spec, thus giving users the least control of the output code.

  1. cmdline arguments
@jianghaolu
jianghaolu / token-refresh-offset-overview.md
Last active June 16, 2020 20:52
Token Refresh Offset Overview

Summary

We are moving the token refresh offset from AccessToken to TokenCredential, to keep the originality and correctness of the expiresAt() getter on AccessToken.

On top of refreshing the token at an offset before expiry, we are also allowing the current non-expired token to be used if a proactive refresh fails. The proactive refresh will be attempted again next time some thread needs to get a token. To prevent too many refresh attempts, there will also be a timeout in place.

Current design

Azure/azure-sdk-for-java#11704

Usage

@jianghaolu
jianghaolu / xplat-shared-token-cache.md
Last active April 7, 2020 20:33
Cross-plat shared token cache

Goal of the proposal

  • Discuss user experience of current design
  • Discuss perf results and possible bottlenecks

Usage

Scenario 1: Use an existing token from an existing cache

SharedTokenCacheCredential credential = new SharedTokenCacheCredentialBuilder().clientId(clientId).build();
SecretClient secretClient = new SecretClientBuilder()
 .vaultUrl("https://my-vault.vault.azure.net")
@jianghaolu
jianghaolu / autorest-v4-structure.md
Last active January 27, 2020 19:02
AutoRest Java & fluent v4 structural changes

Intro

In the past couple months we've made through most of the vanilla features in AutoRest.Java v4. At this point, we are planning for the next phase of work. We want to make a few changes in the AutoRest.Java structure according to

  • The changes in Track 2 azure-core & azure-core-mgmt structure
  • The long-term ownership changes

The goal is to define clear ownership in the long term and easy integration with azure-core, azure-core-mgmt, etc.

Current V2 Structure

@jianghaolu
jianghaolu / authoring-guidelines.md
Last active May 30, 2019 20:28
The Spec for Azure Storage - File & Queue Java Library Track 2 Preview

Storage Track 2 Preview Authoring Guidelines

  • There should be 4 clients created for each generated client, sync client, raw sync client, async client, and raw async client.
  • Normal clients should have private constructors that take the raw client and a builder. Raw clients should have package private constructors and no builders (cannot be instantiated by user).
  • Raw client methods should return Response<T> or VoidResponse. Corresponding normal client methods should return T or void.
  • Raw client methods should take Context context as the last parameter.
  • Raw sync client should take Timeout timeout, Context context as the last 2 parameters.
  • Normal client methods should return a hand-written object type containing aggregated non-trivial information from the AutoRest generated response headers and body. Headers like Content-Length, x-ms-request-id, x-ms-version, x-ms-error-code, Date, etc should not be part of the response type T. If there are no such headers, this method should
@jianghaolu
jianghaolu / webapp-msdeploy.patch
Created December 7, 2017 20:28
Fix Web App MS Deploy Spec
diff --git a/specification/web/resource-manager/Microsoft.Web/2016-08-01/WebApps.json b/specification/web/resource-manager/Microsoft.Web/2016-08-01/WebApps.json
index 80858fa..3f25ad7 100644
--- a/specification/web/resource-manager/Microsoft.Web/2016-08-01/WebApps.json
+++ b/specification/web/resource-manager/Microsoft.Web/2016-08-01/WebApps.json
@@ -15936,8 +15936,12 @@
],
"properties": {
"properties": {
- "$ref": "#/definitions/MSDeployCore",
- "description": "Core resource properties",
@jianghaolu
jianghaolu / publish-to-maven.groovy
Last active March 2, 2017 19:41
Jenkins pipeline script to publish multiple artifacts to maven (on Windows node)
node("adxsdkbuilder") {
deleteDir()
stage('Retrive files') {
print "Retriving from ${location}..."
env.location = location
// Copy to ToSign folder
bat "copy ${env.location}\\*.pom ."
bat "if exist *.jar copy ${env.location}\\*.jar \\\\adxsdkbuilder\\ToSign\\"
def files = findFiles(glob: '*.pom')
// Put all artifact names in an environment variable, comma separated