qcs_api_client_openapi/models/engagement_with_credentials.rs
1// Copyright 2022 Rigetti Computing
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/*
16 * Rigetti QCS API
17 *
18 * # Introduction This is the documentation for the Rigetti QCS HTTP API. You can find out more about Rigetti at [https://rigetti.com](https://rigetti.com), and also interact with QCS via the web at [https://qcs.rigetti.com](https://qcs.rigetti.com). This API is documented in **OpenAPI format** and so is compatible with the dozens of language-specific client generators available [here](https://github.com/OpenAPITools/openapi-generator) and elsewhere on the web. # Principles This API follows REST design principles where appropriate, and otherwise an HTTP RPC paradigm. We adhere to the Google [API Improvement Proposals](https://google.aip.dev/general) where reasonable to provide a consistent, intuitive developer experience. HTTP response codes match their specifications, and error messages fit a common format. # Authentication All access to the QCS API requires OAuth2 authentication provided by Okta. You can request access [here](https://www.rigetti.com/get-quantum). Once you have a user account, you can download your access token from QCS [here](https://qcs.rigetti.com/auth/token). That access token is valid for 24 hours after issuance. The value of `access_token` within the JSON file is the token used for authentication (don't use the entire JSON file). Authenticate requests using the `Authorization` header and a `Bearer` prefix: ``` curl --header \"Authorization: Bearer eyJraW...Iow\" ``` # Quantum Processor Access Access to the quantum processors themselves is not yet provided directly by this HTTP API, but is instead performed over ZeroMQ/[rpcq](https://github.com/rigetti/rpcq). Until that changes, we suggest using [pyquil](https://github.com/rigetti/pyquil) to build and execute quantum programs via the Legacy API. # Legacy API Our legacy HTTP API remains accessible at https://forest-server.qcs.rigetti.com, and it shares a source of truth with this API's services. You can use either service with the same user account and means of authentication. We strongly recommend using the API documented here, as the legacy API is on the path to deprecation.
19 *
20 * The version of the OpenAPI document: 2020-07-31
21 * Contact: support@rigetti.com
22 * Generated by: https://openapi-generator.tech
23 */
24
25/// EngagementWithCredentials : An engagement is the authorization of a user to execute work on a Quantum Processor Endpoint.
26use serde::{Deserialize, Serialize};
27
28#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
29pub struct EngagementWithCredentials {
30 /// User ID or group name on behalf of which the engagement is made.
31 #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
32 pub account_id: Option<String>,
33 /// Indicates whether the grant was made on behalf of a single user or group.
34 #[serde(rename = "accountType", skip_serializing_if = "Option::is_none")]
35 pub account_type: Option<Box<crate::models::AccountType>>,
36 /// The network address of the endpoint to which this engagement grants access
37 #[serde(rename = "address")]
38 pub address: String,
39 #[serde(rename = "credentials")]
40 pub credentials: Box<crate::models::EngagementCredentials>,
41 /// The ID of the endpoint to which this engagement grants access
42 #[serde(rename = "endpointId")]
43 pub endpoint_id: String,
44 /// Time after which the engagement is no longer valid. Given in RFC3339 format.
45 #[serde(rename = "expiresAt")]
46 pub expires_at: String,
47 /// The minimum priority value allowed for execution
48 #[serde(rename = "minimumPriority", skip_serializing_if = "Option::is_none")]
49 pub minimum_priority: Option<i64>,
50 /// The quantum processors for which this engagement enables access and execution
51 #[serde(
52 rename = "quantumProcessorIds",
53 skip_serializing_if = "Option::is_none"
54 )]
55 pub quantum_processor_ids: Option<Vec<String>>,
56 /// Tags recorded on QPU requests and recorded on usage records.
57 #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
58 pub tags: Option<Vec<String>>,
59 #[serde(rename = "userId")]
60 pub user_id: String,
61}
62
63impl EngagementWithCredentials {
64 /// An engagement is the authorization of a user to execute work on a Quantum Processor Endpoint.
65 pub fn new(
66 address: String,
67 credentials: crate::models::EngagementCredentials,
68 endpoint_id: String,
69 expires_at: String,
70 user_id: String,
71 ) -> EngagementWithCredentials {
72 EngagementWithCredentials {
73 account_id: None,
74 account_type: None,
75 address,
76 credentials: Box::new(credentials),
77 endpoint_id,
78 expires_at,
79 minimum_priority: None,
80 quantum_processor_ids: None,
81 tags: None,
82 user_id,
83 }
84 }
85}