Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
/partial-update-tests @weidongxu-microsoft @haolingdong-msft @XiaofeiCao @srnagar
/partial-update @weidongxu-microsoft @haolingdong-msft @XiaofeiCao @srnagar

# cadl
/cadl-extension @srnagar @weidongxu-microsoft @haolingdong-msft @XiaofeiCao
/cadl-tests @weidongxu-microsoft @haolingdong-msft @XiaofeiCao
# typespec
/typespec-extension @srnagar @weidongxu-microsoft @haolingdong-msft @XiaofeiCao
/typespec-tests @weidongxu-microsoft @haolingdong-msft @XiaofeiCao
6 changes: 3 additions & 3 deletions .github/workflows/generate-test-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
options:
- all
- autorest
- cadl
- typespec

jobs:
build:
Expand Down Expand Up @@ -43,10 +43,10 @@ jobs:
./Generate.ps1

- name: Generate test code for typespec-java
if: ${{ inputs.scope == 'all' || inputs.scope == 'cadl' }}
if: ${{ inputs.scope == 'all' || inputs.scope == 'typespec' }}
shell: pwsh
run: |
cd cadl-tests
cd typespec-tests
./Generate.ps1
cd ..

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
VERSION: ${{ github.event.inputs.version }}
run: |
echo "TAG_NAME=@azure-tools/typespec-java_$VERSION" >> $GITHUB_ENV
echo "RELEASE_ARTIFACT=cadl-extension/azure-tools-typespec-java-$VERSION.tgz" >> $GITHUB_ENV
echo "RELEASE_ARTIFACT=typespec-extension/azure-tools-typespec-java-$VERSION.tgz" >> $GITHUB_ENV

- name: Checkout branch
uses: actions/checkout@v3
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Build and Package
run: |
mvn package -f pom.xml -P local,cadl --no-transfer-progress
cd cadl-extension
cd typespec-extension
npm install
npm run build
npm run lint
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ javagen/*.yaml
/azure-dataplane-tests/src/main/java/module-info.java

# Cadl output
/cadl-tests/cadl-output/
/cadl-tests/cadl-ranch-coverage.json
/cadl-tests/cadl-ranch-coverage-java.json
/cadl-tests/cadl-src/
/typespec-tests/tsp-output/
/typespec-tests/cadl-ranch-coverage.json
/typespec-tests/cadl-ranch-coverage-java.json
/typespec-tests/tsp-src/

# Coverage report
/coverage/
Expand Down
10 changes: 5 additions & 5 deletions Generate-TypeSpec.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ function invokeExpressionAndCaptureOutput([string]$expression) {
}
}

Write-Host "Changing directory to './cadl-extension'"
Write-Host "Changing directory to './typespec-extension'"
try {
Push-Location ./cadl-extension
Push-Location ./typespec-extension

Write-Host "Installing dependencies for TypeSpec Java ('npm install')"
invokeExpressionAndCaptureOutput("npm install")
Expand All @@ -46,10 +46,10 @@ Write-Host "Installing TypeSpec ('npm install -g @typespec/compiler')"
invokeExpressionAndCaptureOutput("npm install -g @typespec/compiler")

try {
Write-Host "Changing directory to './cadl-tests'"
Push-Location ./cadl-tests
Write-Host "Changing directory to './typespec-tests'"
Push-Location ./typespec-tests

Write-Host "Generating code ('Generate.ps1' in './cadl-tests')"
Write-Host "Generating code ('Generate.ps1' in './typespec-tests')"
invokeExpressionAndCaptureOutput("./Generate.ps1")

Write-Host "Checking format of generated code ('npm run check-format')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.azure.containers.containerregistry.implementation.models.TokenGrantType;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.FormParam;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
Expand Down Expand Up @@ -110,26 +109,6 @@ Response<AcrAccessToken> exchangeAcrRefreshTokenForAcrAccessTokenSync(
@FormParam("grant_type") TokenGrantType grantType,
@HeaderParam("Accept") String accept,
Context context);

@Get("/oauth2/token")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(AcrErrorsException.class)
Mono<Response<AcrAccessToken>> getAcrAccessTokenFromLogin(
@HostParam("url") String url,
@QueryParam("service") String service,
@QueryParam("scope") String scope,
@HeaderParam("Accept") String accept,
Context context);

@Get("/oauth2/token")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(AcrErrorsException.class)
Response<AcrAccessToken> getAcrAccessTokenFromLoginSync(
@HostParam("url") String url,
@QueryParam("service") String service,
@QueryParam("scope") String scope,
@HeaderParam("Accept") String accept,
Context context);
}

/**
Expand Down Expand Up @@ -464,113 +443,4 @@ public AcrAccessToken exchangeAcrRefreshTokenForAcrAccessToken(
serviceParam, scope, refreshToken, grantType, Context.NONE)
.getValue();
}

/**
* Exchange Username, Password and Scope for an ACR Access Token.
*
* @param serviceParam Indicates the name of your Azure container registry.
* @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You
* can obtain this from the Www-Authenticate response header from the challenge.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws AcrErrorsException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<AcrAccessToken>> getAcrAccessTokenFromLoginWithResponseAsync(
String serviceParam, String scope) {
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.getAcrAccessTokenFromLogin(this.client.getUrl(), serviceParam, scope, accept, context));
}

/**
* Exchange Username, Password and Scope for an ACR Access Token.
*
* @param serviceParam Indicates the name of your Azure container registry.
* @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You
* can obtain this from the Www-Authenticate response header from the challenge.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws AcrErrorsException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<AcrAccessToken>> getAcrAccessTokenFromLoginWithResponseAsync(
String serviceParam, String scope, Context context) {
final String accept = "application/json";
return service.getAcrAccessTokenFromLogin(this.client.getUrl(), serviceParam, scope, accept, context);
}

/**
* Exchange Username, Password and Scope for an ACR Access Token.
*
* @param serviceParam Indicates the name of your Azure container registry.
* @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You
* can obtain this from the Www-Authenticate response header from the challenge.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws AcrErrorsException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<AcrAccessToken> getAcrAccessTokenFromLoginAsync(String serviceParam, String scope) {
return getAcrAccessTokenFromLoginWithResponseAsync(serviceParam, scope)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}

/**
* Exchange Username, Password and Scope for an ACR Access Token.
*
* @param serviceParam Indicates the name of your Azure container registry.
* @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You
* can obtain this from the Www-Authenticate response header from the challenge.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws AcrErrorsException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<AcrAccessToken> getAcrAccessTokenFromLoginAsync(String serviceParam, String scope, Context context) {
return getAcrAccessTokenFromLoginWithResponseAsync(serviceParam, scope, context)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}

/**
* Exchange Username, Password and Scope for an ACR Access Token.
*
* @param serviceParam Indicates the name of your Azure container registry.
* @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You
* can obtain this from the Www-Authenticate response header from the challenge.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws AcrErrorsException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<AcrAccessToken> getAcrAccessTokenFromLoginWithResponse(
String serviceParam, String scope, Context context) {
final String accept = "application/json";
return service.getAcrAccessTokenFromLoginSync(this.client.getUrl(), serviceParam, scope, accept, context);
}

/**
* Exchange Username, Password and Scope for an ACR Access Token.
*
* @param serviceParam Indicates the name of your Azure container registry.
* @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You
* can obtain this from the Www-Authenticate response header from the challenge.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws AcrErrorsException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public AcrAccessToken getAcrAccessTokenFromLogin(String serviceParam, String scope) {
return getAcrAccessTokenFromLoginWithResponse(serviceParam, scope, Context.NONE).getValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public final class OciAnnotations implements JsonSerializable<OciAnnotations> {
* Date and time on which the image was built (string, date-time as defined by
* https://tools.ietf.org/html/rfc3339#section-5.6)
*/
private OffsetDateTime created;
private OffsetDateTime createdOn;

/*
* Contact details of the people or organization responsible for the image.
Expand Down Expand Up @@ -89,24 +89,24 @@ public final class OciAnnotations implements JsonSerializable<OciAnnotations> {
public OciAnnotations() {}

/**
* Get the created property: Date and time on which the image was built (string, date-time as defined by
* Get the createdOn property: Date and time on which the image was built (string, date-time as defined by
* https://tools.ietf.org/html/rfc3339#section-5.6).
*
* @return the created value.
* @return the createdOn value.
*/
public OffsetDateTime getCreated() {
return this.created;
public OffsetDateTime getCreatedOn() {
return this.createdOn;
}

/**
* Set the created property: Date and time on which the image was built (string, date-time as defined by
* Set the createdOn property: Date and time on which the image was built (string, date-time as defined by
* https://tools.ietf.org/html/rfc3339#section-5.6).
*
* @param created the created value to set.
* @param createdOn the createdOn value to set.
* @return the OciAnnotations object itself.
*/
public OciAnnotations setCreated(OffsetDateTime created) {
this.created = created;
public OciAnnotations setCreatedOn(OffsetDateTime createdOn) {
this.createdOn = createdOn;
return this;
}

Expand Down Expand Up @@ -357,7 +357,7 @@ public OciAnnotations setAdditionalProperties(Map<String, Object> additionalProp
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("org.opencontainers.image.created", Objects.toString(this.created, null));
jsonWriter.writeStringField("org.opencontainers.image.created", Objects.toString(this.createdOn, null));
jsonWriter.writeStringField("org.opencontainers.image.authors", this.authors);
jsonWriter.writeStringField("org.opencontainers.image.url", this.url);
jsonWriter.writeStringField("org.opencontainers.image.documentation", this.documentation);
Expand Down Expand Up @@ -395,7 +395,7 @@ public static OciAnnotations fromJson(JsonReader jsonReader) throws IOException
reader.nextToken();

if ("org.opencontainers.image.created".equals(fieldName)) {
deserializedOciAnnotations.created =
deserializedOciAnnotations.createdOn =
reader.getNullable(
nonNullReader -> OffsetDateTime.parse(nonNullReader.getString()));
} else if ("org.opencontainers.image.authors".equals(fieldName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class OciImageManifest implements JsonSerializable<OciImageManifest
/*
* V2 image config descriptor
*/
private OciDescriptor config;
private OciDescriptor configuration;

/*
* List of V2 image layer information
Expand All @@ -33,28 +33,28 @@ public final class OciImageManifest implements JsonSerializable<OciImageManifest
/*
* Schema version
*/
private int schemaVersion = 2;
private int schemaVersion;

/** Creates an instance of OciImageManifest class. */
public OciImageManifest() {}

/**
* Get the config property: V2 image config descriptor.
* Get the configuration property: V2 image config descriptor.
*
* @return the config value.
* @return the configuration value.
*/
public OciDescriptor getConfig() {
return this.config;
public OciDescriptor getConfiguration() {
return this.configuration;
}

/**
* Set the config property: V2 image config descriptor.
* Set the configuration property: V2 image config descriptor.
*
* @param config the config value to set.
* @param configuration the configuration value to set.
* @return the OciImageManifest object itself.
*/
public OciImageManifest setConfig(OciDescriptor config) {
this.config = config;
public OciImageManifest setConfiguration(OciDescriptor configuration) {
this.configuration = configuration;
return this;
}

Expand Down Expand Up @@ -122,7 +122,7 @@ public OciImageManifest setSchemaVersion(int schemaVersion) {
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeIntField("schemaVersion", this.schemaVersion);
jsonWriter.writeJsonField("config", this.config);
jsonWriter.writeJsonField("config", this.configuration);
jsonWriter.writeArrayField("layers", this.layers, (writer, element) -> writer.writeJson(element));
jsonWriter.writeJsonField("annotations", this.annotations);
return jsonWriter.writeEndObject();
Expand All @@ -148,7 +148,7 @@ public static OciImageManifest fromJson(JsonReader jsonReader) throws IOExceptio
if ("schemaVersion".equals(fieldName)) {
deserializedOciImageManifest.schemaVersion = reader.getInt();
} else if ("config".equals(fieldName)) {
deserializedOciImageManifest.config = OciDescriptor.fromJson(reader);
deserializedOciImageManifest.configuration = OciDescriptor.fromJson(reader);
} else if ("layers".equals(fieldName)) {
List<OciDescriptor> layers = reader.readArray(reader1 -> OciDescriptor.fromJson(reader1));
deserializedOciImageManifest.layers = layers;
Expand Down
Loading