Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
7943db2
Add .gitignore
vxfield Jan 20, 2021
0d0c2fb
add autogenerated code
Jan 21, 2021
fdce73c
add pom file; regenerate code with fluent:false
Jan 21, 2021
6b88dec
change naming; add preliminary tests
Jan 22, 2021
3c29b78
Add auth layer; working list test
Jan 25, 2021
04b9554
Add auth layer; working list test (#18796)
anjbur Jan 26, 2021
0a333c9
add dependency scope
Jan 26, 2021
3d7b32a
Merge branch 'feature/azure-quantum-sdk' of github.com:Azure/azure-sd…
Jan 26, 2021
13572b9
cleanup
Jan 26, 2021
2ddf645
add ci.yml; update pom.xml
Jan 26, 2021
5428b34
move and update ci.yml
Jan 26, 2021
f164859
move pom.xml to root
Jan 26, 2021
63a015f
update pom.xml and ci.yml
Jan 26, 2021
6ed50c0
regenerate code with authentication
Jan 26, 2021
ee87036
add credentials code
Jan 26, 2021
1fcc15d
add module-info.java
Jan 27, 2021
7dedc8e
add second pom.xml
Jan 27, 2021
1504474
add parent to pom.xml
Jan 27, 2021
23fc441
add quantum module to root pom.xml
Jan 27, 2021
f9d7530
update root pom.xml
Jan 27, 2021
02b77fa
update project pom
Jan 27, 2021
616c13c
remove comment at start
Jan 27, 2021
649f771
update versions, add maven-enforcer-plugin
Jan 27, 2021
3a3696a
fix versioning
Jan 27, 2021
47887b3
add README, CHANGELOG
Jan 27, 2021
777ce4e
add tests.yml
Jan 27, 2021
d3204fb
fix readme
Jan 27, 2021
2aa059a
fix changelong
Jan 27, 2021
3909fc4
update changelog
Jan 27, 2021
e156c52
Update CHANGELOG.md
vxfield Jan 27, 2021
138009b
update version, skip test coverage
Jan 27, 2021
6e3c632
Merge branch 'feature/azure-quantum-sdk' of github.com:Azure/azure-sd…
Jan 27, 2021
19fb0ff
add runtime/compile scopes to pom.xml
Jan 27, 2021
c793d3e
prune pom.xml
Jan 27, 2021
9d8cdd8
add back dependency
Jan 27, 2021
08216c4
suppress alerts on generated code
Jan 28, 2021
c0d5df7
only suppress generated code
Jan 28, 2021
76f0506
add playback tests
Jan 28, 2021
8967268
fix header on tests
Jan 28, 2021
04da2b7
PR comment fixes
Jan 28, 2021
b455895
PR comment fixes
Jan 28, 2021
2d13b53
fix pom.xml
Jan 28, 2021
74d72a5
PR comments
Jan 29, 2021
9970901
resolve PR comment
Jan 29, 2021
1638e0b
fix version file
Jan 29, 2021
e646d16
fix tests.yml
Jan 29, 2021
ccaef0e
fix groupId in ci.yml
Jan 29, 2021
95649a8
change from no test coverage to minimal coverage required
Jan 29, 2021
8fad6c0
resolve PR comments
Jan 29, 2021
333827f
remove unused imports
Jan 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sdk/quantum/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Temp files used to auto-generate code
Comment thread
anjbur marked this conversation as resolved.
Outdated
temp/

Empty file.
56 changes: 56 additions & 0 deletions sdk/quantum/azure-quantum/pom.xml
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} -->
Comment thread
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 sdk/quantum/azure-quantum/src/main/java/com/azure/quantum/Jobs.java
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));
}
}
Loading