aws-sdk-codegurusecurity 1.98.0

AWS SDK for Amazon CodeGuru Security
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct CreateUploadUrlOutput {
    /// <p>A pre-signed S3 URL. You can upload the code file you want to scan with the required <code>requestHeaders</code> using any HTTP client.</p>
    pub s3_url: ::std::string::String,
    /// <p>A set of key-value pairs that contain the required headers when uploading your resource.</p>
    pub request_headers: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
    /// <p>The identifier for the uploaded code resource. Pass this to <code>CreateScan</code> to use the uploaded resources.</p>
    pub code_artifact_id: ::std::string::String,
    _request_id: Option<String>,
}
impl CreateUploadUrlOutput {
    /// <p>A pre-signed S3 URL. You can upload the code file you want to scan with the required <code>requestHeaders</code> using any HTTP client.</p>
    pub fn s3_url(&self) -> &str {
        use std::ops::Deref;
        self.s3_url.deref()
    }
    /// <p>A set of key-value pairs that contain the required headers when uploading your resource.</p>
    pub fn request_headers(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> {
        &self.request_headers
    }
    /// <p>The identifier for the uploaded code resource. Pass this to <code>CreateScan</code> to use the uploaded resources.</p>
    pub fn code_artifact_id(&self) -> &str {
        use std::ops::Deref;
        self.code_artifact_id.deref()
    }
}
impl ::std::fmt::Debug for CreateUploadUrlOutput {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("CreateUploadUrlOutput");
        formatter.field("s3_url", &"*** Sensitive Data Redacted ***");
        formatter.field("request_headers", &"*** Sensitive Data Redacted ***");
        formatter.field("code_artifact_id", &self.code_artifact_id);
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}
impl ::aws_types::request_id::RequestId for CreateUploadUrlOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl CreateUploadUrlOutput {
    /// Creates a new builder-style object to manufacture [`CreateUploadUrlOutput`](crate::operation::create_upload_url::CreateUploadUrlOutput).
    pub fn builder() -> crate::operation::create_upload_url::builders::CreateUploadUrlOutputBuilder {
        crate::operation::create_upload_url::builders::CreateUploadUrlOutputBuilder::default()
    }
}

/// A builder for [`CreateUploadUrlOutput`](crate::operation::create_upload_url::CreateUploadUrlOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct CreateUploadUrlOutputBuilder {
    pub(crate) s3_url: ::std::option::Option<::std::string::String>,
    pub(crate) request_headers: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    pub(crate) code_artifact_id: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl CreateUploadUrlOutputBuilder {
    /// <p>A pre-signed S3 URL. You can upload the code file you want to scan with the required <code>requestHeaders</code> using any HTTP client.</p>
    /// This field is required.
    pub fn s3_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.s3_url = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A pre-signed S3 URL. You can upload the code file you want to scan with the required <code>requestHeaders</code> using any HTTP client.</p>
    pub fn set_s3_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.s3_url = input;
        self
    }
    /// <p>A pre-signed S3 URL. You can upload the code file you want to scan with the required <code>requestHeaders</code> using any HTTP client.</p>
    pub fn get_s3_url(&self) -> &::std::option::Option<::std::string::String> {
        &self.s3_url
    }
    /// Adds a key-value pair to `request_headers`.
    ///
    /// To override the contents of this collection use [`set_request_headers`](Self::set_request_headers).
    ///
    /// <p>A set of key-value pairs that contain the required headers when uploading your resource.</p>
    pub fn request_headers(
        mut self,
        k: impl ::std::convert::Into<::std::string::String>,
        v: impl ::std::convert::Into<::std::string::String>,
    ) -> Self {
        let mut hash_map = self.request_headers.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.request_headers = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>A set of key-value pairs that contain the required headers when uploading your resource.</p>
    pub fn set_request_headers(
        mut self,
        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    ) -> Self {
        self.request_headers = input;
        self
    }
    /// <p>A set of key-value pairs that contain the required headers when uploading your resource.</p>
    pub fn get_request_headers(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.request_headers
    }
    /// <p>The identifier for the uploaded code resource. Pass this to <code>CreateScan</code> to use the uploaded resources.</p>
    /// This field is required.
    pub fn code_artifact_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.code_artifact_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier for the uploaded code resource. Pass this to <code>CreateScan</code> to use the uploaded resources.</p>
    pub fn set_code_artifact_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.code_artifact_id = input;
        self
    }
    /// <p>The identifier for the uploaded code resource. Pass this to <code>CreateScan</code> to use the uploaded resources.</p>
    pub fn get_code_artifact_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.code_artifact_id
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`CreateUploadUrlOutput`](crate::operation::create_upload_url::CreateUploadUrlOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`s3_url`](crate::operation::create_upload_url::builders::CreateUploadUrlOutputBuilder::s3_url)
    /// - [`request_headers`](crate::operation::create_upload_url::builders::CreateUploadUrlOutputBuilder::request_headers)
    /// - [`code_artifact_id`](crate::operation::create_upload_url::builders::CreateUploadUrlOutputBuilder::code_artifact_id)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::create_upload_url::CreateUploadUrlOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::create_upload_url::CreateUploadUrlOutput {
            s3_url: self.s3_url.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "s3_url",
                    "s3_url was not specified but it is required when building CreateUploadUrlOutput",
                )
            })?,
            request_headers: self.request_headers.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "request_headers",
                    "request_headers was not specified but it is required when building CreateUploadUrlOutput",
                )
            })?,
            code_artifact_id: self.code_artifact_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "code_artifact_id",
                    "code_artifact_id was not specified but it is required when building CreateUploadUrlOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}
impl ::std::fmt::Debug for CreateUploadUrlOutputBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("CreateUploadUrlOutputBuilder");
        formatter.field("s3_url", &"*** Sensitive Data Redacted ***");
        formatter.field("request_headers", &"*** Sensitive Data Redacted ***");
        formatter.field("code_artifact_id", &self.code_artifact_id);
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}