#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(clippy::redundant_clone)]
pub mod models;
#[derive(Clone)]
pub struct Client {
endpoint: String,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
pipeline: azure_core::Pipeline,
}
#[derive(Clone)]
pub struct ClientBuilder {
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
endpoint: Option<String>,
scopes: Option<Vec<String>>,
options: azure_core::ClientOptions,
}
pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD;
impl ClientBuilder {
#[doc = "Create a new instance of `ClientBuilder`."]
#[must_use]
pub fn new(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> Self {
Self {
credential,
endpoint: None,
scopes: None,
options: azure_core::ClientOptions::default(),
}
}
#[doc = "Set the endpoint."]
#[must_use]
pub fn endpoint(mut self, endpoint: impl Into<String>) -> Self {
self.endpoint = Some(endpoint.into());
self
}
#[doc = "Set the scopes."]
#[must_use]
pub fn scopes(mut self, scopes: &[&str]) -> Self {
self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect());
self
}
#[doc = "Set the retry options."]
#[must_use]
pub fn retry(mut self, retry: impl Into<azure_core::RetryOptions>) -> Self {
self.options = self.options.retry(retry);
self
}
#[doc = "Set the transport options."]
#[must_use]
pub fn transport(mut self, transport: impl Into<azure_core::TransportOptions>) -> Self {
self.options = self.options.transport(transport);
self
}
#[doc = "Convert the builder into a `Client` instance."]
#[must_use]
pub fn build(self) -> Client {
let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]);
Client::new(endpoint, self.credential, scopes, self.options)
}
}
impl Client {
pub(crate) fn endpoint(&self) -> &str {
self.endpoint.as_str()
}
pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential {
self.credential.as_ref()
}
pub(crate) fn scopes(&self) -> Vec<&str> {
self.scopes.iter().map(String::as_str).collect()
}
pub(crate) async fn send(&self, request: &mut azure_core::Request) -> azure_core::Result<azure_core::Response> {
let mut context = azure_core::Context::default();
self.pipeline.send(&mut context, request).await
}
#[doc = "Create a new `ClientBuilder`."]
#[must_use]
pub fn builder(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> ClientBuilder {
ClientBuilder::new(credential)
}
#[doc = "Create a new `Client`."]
#[must_use]
pub fn new(
endpoint: impl Into<String>,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
options: azure_core::ClientOptions,
) -> Self {
let endpoint = endpoint.into();
let pipeline = azure_core::Pipeline::new(
option_env!("CARGO_PKG_NAME"),
option_env!("CARGO_PKG_VERSION"),
options,
Vec::new(),
Vec::new(),
);
Self {
endpoint,
credential,
scopes,
pipeline,
}
}
pub fn attestation_client(&self) -> attestation::Client {
attestation::Client(self.clone())
}
pub fn metadata_configuration_client(&self) -> metadata_configuration::Client {
metadata_configuration::Client(self.clone())
}
pub fn policy_client(&self) -> policy::Client {
policy::Client(self.clone())
}
pub fn policy_certificates_client(&self) -> policy_certificates::Client {
policy_certificates::Client(self.clone())
}
pub fn signing_certificates_client(&self) -> signing_certificates::Client {
signing_certificates::Client(self.clone())
}
pub fn tcb_baselines_client(&self) -> tcb_baselines::Client {
tcb_baselines::Client(self.clone())
}
}
pub mod policy {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the current policy for an attestation type."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `attestation_type`: Specifies the trusted execution environment to be used to validate the evidence"]
pub fn get(&self, attestation_type: impl Into<String>) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
attestation_type: attestation_type.into(),
}
}
#[doc = "Sets the policy for a given attestation type."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `attestation_type`: Specifies the trusted execution environment to be used to validate the evidence"]
#[doc = "* `new_attestation_policy`: JWT Expressing the new policy whose body is a StoredAttestationPolicy object."]
pub fn set(
&self,
attestation_type: impl Into<String>,
new_attestation_policy: impl Into<models::JsonWebToken>,
) -> set::RequestBuilder {
set::RequestBuilder {
client: self.0.clone(),
attestation_type: attestation_type.into(),
new_attestation_policy: new_attestation_policy.into(),
}
}
#[doc = "Resets the attestation policy for the specified tenant and reverts to the default policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `attestation_type`: Specifies the trusted execution environment to be used to validate the evidence"]
#[doc = "* `policy_jws`: JSON Web Signature with an empty policy document"]
pub fn reset(&self, attestation_type: impl Into<String>, policy_jws: impl Into<models::JsonWebToken>) -> reset::RequestBuilder {
reset::RequestBuilder {
client: self.0.clone(),
attestation_type: attestation_type.into(),
policy_jws: policy_jws.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PolicyResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::PolicyResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) attestation_type: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/policies/{}", this.client.endpoint(), &this.attestation_type))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-09-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PolicyResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod set {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PolicyResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::PolicyResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) attestation_type: String,
pub(crate) new_attestation_policy: models::JsonWebToken,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/policies/{}", this.client.endpoint(), &this.attestation_type))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-09-01-preview");
req.insert_header("content-type", "text/plain");
let req_body = azure_core::to_json(&this.new_attestation_policy)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PolicyResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod reset {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PolicyResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::PolicyResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) attestation_type: String,
pub(crate) policy_jws: models::JsonWebToken,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/policies/{}:reset", this.client.endpoint(), &this.attestation_type))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-09-01-preview");
req.insert_header("content-type", "text/plain");
let req_body = azure_core::to_json(&this.policy_jws)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PolicyResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod policy_certificates {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the set of certificates used to express policy for the current tenant."]
pub fn get(&self) -> get::RequestBuilder {
get::RequestBuilder { client: self.0.clone() }
}
#[doc = "Adds a new attestation policy certificate to the set of policy management certificates."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `policy_certificate_to_add`: An RFC7519 JSON Web Token whose body is an RFC7517 JSON Web Key object. The RFC7519 JWT must be signed with one of the existing signing certificates"]
pub fn add(&self, policy_certificate_to_add: impl Into<models::JsonWebToken>) -> add::RequestBuilder {
add::RequestBuilder {
client: self.0.clone(),
policy_certificate_to_add: policy_certificate_to_add.into(),
}
}
#[doc = "Removes the specified policy management certificate. Note that the final policy management certificate cannot be removed."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `policy_certificate_to_remove`: An RFC7519 JSON Web Token whose body is an AttestationCertificateManagementBody object. The RFC7519 JWT must be signed with one of the existing signing certificates"]
pub fn remove(&self, policy_certificate_to_remove: impl Into<models::JsonWebToken>) -> remove::RequestBuilder {
remove::RequestBuilder {
client: self.0.clone(),
policy_certificate_to_remove: policy_certificate_to_remove.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PolicyCertificatesResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::PolicyCertificatesResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/certificates", this.client.endpoint(),))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-09-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PolicyCertificatesResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod add {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PolicyCertificatesModifyResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::PolicyCertificatesModifyResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) policy_certificate_to_add: models::JsonWebToken,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/certificates:add", this.client.endpoint(),))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-09-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.policy_certificate_to_add)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PolicyCertificatesModifyResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod remove {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PolicyCertificatesModifyResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::PolicyCertificatesModifyResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) policy_certificate_to_remove: models::JsonWebToken,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/certificates:remove", this.client.endpoint(),))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-09-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.policy_certificate_to_remove)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PolicyCertificatesModifyResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod attestation {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Attest to an SGX enclave."]
#[doc = "Processes an OpenEnclave report , producing an artifact. The type of artifact produced is dependent upon attestation policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `request`: Request object containing the quote"]
pub fn attest_open_enclave(&self, request: impl Into<models::AttestOpenEnclaveRequest>) -> attest_open_enclave::RequestBuilder {
attest_open_enclave::RequestBuilder {
client: self.0.clone(),
request: request.into(),
}
}
#[doc = "Attest to an SGX enclave."]
#[doc = "Processes an SGX enclave quote, producing an artifact. The type of artifact produced is dependent upon attestation policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `request`: Request object containing the quote"]
pub fn attest_sgx_enclave(&self, request: impl Into<models::AttestSgxEnclaveRequest>) -> attest_sgx_enclave::RequestBuilder {
attest_sgx_enclave::RequestBuilder {
client: self.0.clone(),
request: request.into(),
}
}
#[doc = "Attest a Virtualization-based Security (VBS) enclave."]
#[doc = "Processes attestation evidence from a VBS enclave, producing an attestation result. The attestation result produced is dependent upon the attestation policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `request`: Request object"]
pub fn attest_tpm(&self, request: impl Into<models::TpmAttestationRequest>) -> attest_tpm::RequestBuilder {
attest_tpm::RequestBuilder {
client: self.0.clone(),
request: request.into(),
}
}
#[doc = "Attest to an SEV SNP Virtual Machine."]
#[doc = "Processes a SEV SNP Boot chain. The type of artifact produced is dependent upon attestation policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `request`: Request object containing the quote"]
pub fn attest_sev_snp_vm(&self, request: impl Into<models::AttestSevSnpVmRequest>) -> attest_sev_snp_vm::RequestBuilder {
attest_sev_snp_vm::RequestBuilder {
client: self.0.clone(),
request: request.into(),
}
}
}
pub mod attest_open_enclave {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::AttestationResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::AttestationResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) request: models::AttestOpenEnclaveRequest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/attest/OpenEnclave", this.client.endpoint(),))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-09-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.request)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::AttestationResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod attest_sgx_enclave {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::AttestationResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::AttestationResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) request: models::AttestSgxEnclaveRequest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/attest/SgxEnclave", this.client.endpoint(),))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-09-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.request)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::AttestationResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod attest_tpm {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TpmAttestationResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::TpmAttestationResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) request: models::TpmAttestationRequest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/attest/Tpm", this.client.endpoint(),))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-09-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.request)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::TpmAttestationResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod attest_sev_snp_vm {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::AttestationResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::AttestationResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) request: models::AttestSevSnpVmRequest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/attest/SevSnpVm", this.client.endpoint(),))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-09-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.request)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::AttestationResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod tcb_baselines {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves a list of all Azure supported baseline details for the a TEE type along with an indication of which one is in enforced for the attestation provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `attestation_type`: Specifies the trusted execution environment to be used to validate the evidence"]
pub fn get(&self, attestation_type: impl Into<String>) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
attestation_type: attestation_type.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TcbBaselineResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::TcbBaselineResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) attestation_type: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/tcbbaselines/{}", this.client.endpoint(), &this.attestation_type))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-09-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::TcbBaselineResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod signing_certificates {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the attestation signing keys in use by the attestation service"]
#[doc = "Retrieves metadata signing certificates in use by the attestation service"]
pub fn get(&self) -> get::RequestBuilder {
get::RequestBuilder { client: self.0.clone() }
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JsonWebKeySet> {
let bytes = self.0.into_body().collect().await?;
let body: models::JsonWebKeySet = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/certs", this.client.endpoint(),))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JsonWebKeySet>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod metadata_configuration {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the OpenID Configuration data for the Azure Attestation Service"]
#[doc = "Retrieves metadata about the attestation signing keys in use by the attestation service"]
pub fn get(&self) -> get::RequestBuilder {
get::RequestBuilder { client: self.0.clone() }
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OpenIdConfigurationResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::OpenIdConfigurationResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!("{}/.well-known/openid-configuration", this.client.endpoint(),))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::OpenIdConfigurationResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}