-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Azure Quantum client for Azure SDK for Java #18734
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
Changes from 4 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
7943db2
Add .gitignore
vxfield 0d0c2fb
add autogenerated code
fdce73c
add pom file; regenerate code with fluent:false
6b88dec
change naming; add preliminary tests
3c29b78
Add auth layer; working list test
04b9554
Add auth layer; working list test (#18796)
anjbur 0a333c9
add dependency scope
3d7b32a
Merge branch 'feature/azure-quantum-sdk' of github.com:Azure/azure-sd…
13572b9
cleanup
2ddf645
add ci.yml; update pom.xml
5428b34
move and update ci.yml
f164859
move pom.xml to root
63a015f
update pom.xml and ci.yml
6ed50c0
regenerate code with authentication
ee87036
add credentials code
1fcc15d
add module-info.java
7dedc8e
add second pom.xml
1504474
add parent to pom.xml
23fc441
add quantum module to root pom.xml
f9d7530
update root pom.xml
02b77fa
update project pom
616c13c
remove comment at start
649f771
update versions, add maven-enforcer-plugin
3a3696a
fix versioning
47887b3
add README, CHANGELOG
777ce4e
add tests.yml
d3204fb
fix readme
2aa059a
fix changelong
3909fc4
update changelog
e156c52
Update CHANGELOG.md
vxfield 138009b
update version, skip test coverage
6e3c632
Merge branch 'feature/azure-quantum-sdk' of github.com:Azure/azure-sd…
19fb0ff
add runtime/compile scopes to pom.xml
c793d3e
prune pom.xml
9d8cdd8
add back dependency
08216c4
suppress alerts on generated code
c0d5df7
only suppress generated code
76f0506
add playback tests
8967268
fix header on tests
04da2b7
PR comment fixes
b455895
PR comment fixes
2d13b53
fix pom.xml
74d72a5
PR comments
9970901
resolve PR comment
1638e0b
fix version file
e646d16
fix tests.yml
ccaef0e
fix groupId in ci.yml
95649a8
change from no test coverage to minimal coverage required
8fad6c0
resolve PR comments
333827f
remove unused imports
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Temp files used to auto-generate code | ||
| temp/ | ||
|
|
||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>com.azure.quantum</groupId> | ||
| <artifactId>azure-quantum</artifactId> | ||
| <version>1.0-SNAPSHOT</version> | ||
|
|
||
| <properties> | ||
| <maven.compiler.source>8</maven.compiler.source> | ||
| <maven.compiler.target>8</maven.compiler.target> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-core</artifactId> | ||
| <version>1.12.0</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-core-management</artifactId> | ||
| <version>1.0.0</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure.resourcemanager</groupId> | ||
| <artifactId>azure-resourcemanager-resources</artifactId> | ||
| <version>2.1.0</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-core-http-netty</artifactId> | ||
| <version>1.7.1</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} --> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <!-- dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-nop</artifactId> | ||
| <version>1.7.30</version> <! {x-version-update;org.slf4j:slf4j-nop;external_dependency} --> | ||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-simple</artifactId> | ||
| <version>1.7.30</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} --> | ||
|
anjbur marked this conversation as resolved.
Outdated
|
||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter-api</artifactId> | ||
| <version>5.6.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-api;external_dependency} --> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
|
|
||
| </project> | ||
301 changes: 301 additions & 0 deletions
301
sdk/quantum/azure-quantum/src/main/java/com/azure/quantum/Jobs.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,301 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for | ||
| // license information. | ||
| // | ||
| // Code generated by Microsoft (R) AutoRest Code Generator. | ||
|
|
||
| package com.azure.quantum; | ||
|
|
||
| import com.azure.core.annotation.BodyParam; | ||
| import com.azure.core.annotation.Delete; | ||
| import com.azure.core.annotation.ExpectedResponses; | ||
| import com.azure.core.annotation.Get; | ||
| import com.azure.core.annotation.HeaderParam; | ||
| import com.azure.core.annotation.Host; | ||
| import com.azure.core.annotation.HostParam; | ||
| import com.azure.core.annotation.PathParam; | ||
| import com.azure.core.annotation.Put; | ||
| import com.azure.core.annotation.ReturnType; | ||
| import com.azure.core.annotation.ServiceInterface; | ||
| import com.azure.core.annotation.ServiceMethod; | ||
| import com.azure.core.annotation.UnexpectedResponseExceptionType; | ||
| import com.azure.core.exception.HttpResponseException; | ||
| import com.azure.core.http.rest.PagedFlux; | ||
| import com.azure.core.http.rest.PagedResponse; | ||
| import com.azure.core.http.rest.PagedResponseBase; | ||
| import com.azure.core.http.rest.Response; | ||
| import com.azure.core.http.rest.RestProxy; | ||
| import com.azure.quantum.models.JobDetails; | ||
| import com.azure.quantum.models.JobDetailsList; | ||
| import com.azure.quantum.models.RestErrorException; | ||
| import reactor.core.publisher.Mono; | ||
|
|
||
| /** An instance of this class provides access to all the operations defined in Jobs. */ | ||
| public final class Jobs { | ||
| /** The proxy service used to perform REST calls. */ | ||
| private final JobsService service; | ||
|
|
||
| /** The service client containing this operation class. */ | ||
| private final QuantumClient client; | ||
|
|
||
| /** | ||
| * Initializes an instance of Jobs. | ||
| * | ||
| * @param client the instance of the service client containing this operation class. | ||
| */ | ||
| Jobs(QuantumClient client) { | ||
| this.service = RestProxy.create(JobsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); | ||
| this.client = client; | ||
| } | ||
|
|
||
| /** | ||
| * The interface defining all the services for QuantumClientJobs to be used by the proxy service to perform REST | ||
| * calls. | ||
| */ | ||
| @Host("{$host}") | ||
| @ServiceInterface(name = "QuantumClientJobs") | ||
| private interface JobsService { | ||
| @Get( | ||
| "/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs") | ||
| @ExpectedResponses({200}) | ||
| @UnexpectedResponseExceptionType(HttpResponseException.class) | ||
| Mono<Response<JobDetailsList>> list( | ||
| @HostParam("$host") String host, | ||
| @PathParam("subscriptionId") String subscriptionId, | ||
| @PathParam("resourceGroupName") String resourceGroupName, | ||
| @PathParam("workspaceName") String workspaceName, | ||
| @HeaderParam("Accept") String accept); | ||
|
|
||
| @Get( | ||
| "/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}") | ||
| @ExpectedResponses({200}) | ||
| @UnexpectedResponseExceptionType(RestErrorException.class) | ||
| Mono<Response<JobDetails>> get( | ||
| @HostParam("$host") String host, | ||
| @PathParam("subscriptionId") String subscriptionId, | ||
| @PathParam("resourceGroupName") String resourceGroupName, | ||
| @PathParam("workspaceName") String workspaceName, | ||
| @PathParam("jobId") String jobId, | ||
| @HeaderParam("Accept") String accept); | ||
|
|
||
| @Put( | ||
| "/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}") | ||
| @ExpectedResponses({200, 201}) | ||
| @UnexpectedResponseExceptionType(RestErrorException.class) | ||
| Mono<Response<JobDetails>> create( | ||
| @HostParam("$host") String host, | ||
| @PathParam("subscriptionId") String subscriptionId, | ||
| @PathParam("resourceGroupName") String resourceGroupName, | ||
| @PathParam("workspaceName") String workspaceName, | ||
| @PathParam("jobId") String jobId, | ||
| @BodyParam("application/json") JobDetails job, | ||
| @HeaderParam("Accept") String accept); | ||
|
|
||
| @Delete( | ||
| "/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}") | ||
| @ExpectedResponses({204}) | ||
| @UnexpectedResponseExceptionType(RestErrorException.class) | ||
| Mono<Response<Void>> cancel( | ||
| @HostParam("$host") String host, | ||
| @PathParam("subscriptionId") String subscriptionId, | ||
| @PathParam("resourceGroupName") String resourceGroupName, | ||
| @PathParam("workspaceName") String workspaceName, | ||
| @PathParam("jobId") String jobId, | ||
| @HeaderParam("Accept") String accept); | ||
|
|
||
| @Get("{nextLink}") | ||
| @ExpectedResponses({200}) | ||
| @UnexpectedResponseExceptionType(HttpResponseException.class) | ||
| Mono<Response<JobDetailsList>> listNext( | ||
| @PathParam(value = "nextLink", encoded = true) String nextLink, | ||
| @HostParam("$host") String host, | ||
| @HeaderParam("Accept") String accept); | ||
| } | ||
|
|
||
| /** | ||
| * List jobs. | ||
| * | ||
| * @throws HttpResponseException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return list of job details. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<PagedResponse<JobDetails>> listSinglePageAsync() { | ||
| final String accept = "application/json"; | ||
| return service.list( | ||
| this.client.getHost(), | ||
| this.client.getSubscriptionId(), | ||
| this.client.getResourceGroupName(), | ||
| this.client.getWorkspaceName(), | ||
| accept) | ||
| .map( | ||
| res -> | ||
| new PagedResponseBase<>( | ||
| res.getRequest(), | ||
| res.getStatusCode(), | ||
| res.getHeaders(), | ||
| res.getValue().getValue(), | ||
| res.getValue().getNextLink(), | ||
| null)); | ||
| } | ||
|
|
||
| /** | ||
| * List jobs. | ||
| * | ||
| * @throws HttpResponseException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return list of job details. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.COLLECTION) | ||
| public PagedFlux<JobDetails> listAsync() { | ||
| return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); | ||
| } | ||
|
|
||
| /** | ||
| * Get job by id. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return job by id. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<Response<JobDetails>> getWithResponseAsync(String jobId) { | ||
| final String accept = "application/json"; | ||
| return service.get( | ||
| this.client.getHost(), | ||
| this.client.getSubscriptionId(), | ||
| this.client.getResourceGroupName(), | ||
| this.client.getWorkspaceName(), | ||
| jobId, | ||
| accept); | ||
| } | ||
|
|
||
| /** | ||
| * Get job by id. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return job by id. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<JobDetails> getAsync(String jobId) { | ||
| return getWithResponseAsync(jobId) | ||
| .flatMap( | ||
| (Response<JobDetails> res) -> { | ||
| if (res.getValue() != null) { | ||
| return Mono.just(res.getValue()); | ||
| } else { | ||
| return Mono.empty(); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Create a job. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @param job The complete metadata of the job to submit. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return job details. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<Response<JobDetails>> createWithResponseAsync(String jobId, JobDetails job) { | ||
| final String accept = "application/json"; | ||
| return service.create( | ||
| this.client.getHost(), | ||
| this.client.getSubscriptionId(), | ||
| this.client.getResourceGroupName(), | ||
| this.client.getWorkspaceName(), | ||
| jobId, | ||
| job, | ||
| accept); | ||
| } | ||
|
|
||
| /** | ||
| * Create a job. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @param job The complete metadata of the job to submit. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return job details. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<JobDetails> createAsync(String jobId, JobDetails job) { | ||
| return createWithResponseAsync(jobId, job) | ||
| .flatMap( | ||
| (Response<JobDetails> res) -> { | ||
| if (res.getValue() != null) { | ||
| return Mono.just(res.getValue()); | ||
| } else { | ||
| return Mono.empty(); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Cancel a job. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return the completion. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<Response<Void>> cancelWithResponseAsync(String jobId) { | ||
| final String accept = "application/json"; | ||
| return service.cancel( | ||
| this.client.getHost(), | ||
| this.client.getSubscriptionId(), | ||
| this.client.getResourceGroupName(), | ||
| this.client.getWorkspaceName(), | ||
| jobId, | ||
| accept); | ||
| } | ||
|
|
||
| /** | ||
| * Cancel a job. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return the completion. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<Void> cancelAsync(String jobId) { | ||
| return cancelWithResponseAsync(jobId).flatMap((Response<Void> res) -> Mono.empty()); | ||
| } | ||
|
|
||
| /** | ||
| * Get the next page of items. | ||
| * | ||
| * @param nextLink The nextLink parameter. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws HttpResponseException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return list of job details. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<PagedResponse<JobDetails>> listNextSinglePageAsync(String nextLink) { | ||
| final String accept = "application/json"; | ||
| return service.listNext(nextLink, this.client.getHost(), accept) | ||
| .map( | ||
| res -> | ||
| new PagedResponseBase<>( | ||
| res.getRequest(), | ||
| res.getStatusCode(), | ||
| res.getHeaders(), | ||
| res.getValue().getValue(), | ||
| res.getValue().getNextLink(), | ||
| null)); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.