google-cloud-storage 1.11.0

Google Cloud Client Libraries for Rust - Storage
Documentation
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

impl gaxi::prost::ToProto<GetOperationRequest> for google_cloud_longrunning::model::GetOperationRequest {
    type Output = GetOperationRequest;
    fn to_proto(self) -> std::result::Result<GetOperationRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<google_cloud_longrunning::model::GetOperationRequest> for GetOperationRequest {
    fn cnv(self) -> std::result::Result<google_cloud_longrunning::model::GetOperationRequest, gaxi::prost::ConvertError> {
        Ok(
            google_cloud_longrunning::model::GetOperationRequest::new()
                .set_name(self.name)
        )
    }
}

impl gaxi::prost::ToProto<ListOperationsRequest> for google_cloud_longrunning::model::ListOperationsRequest {
    type Output = ListOperationsRequest;
    fn to_proto(self) -> std::result::Result<ListOperationsRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            filter: self.filter.to_proto()?,
            page_size: self.page_size.to_proto()?,
            page_token: self.page_token.to_proto()?,
            return_partial_success: self.return_partial_success.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<google_cloud_longrunning::model::ListOperationsRequest> for ListOperationsRequest {
    fn cnv(self) -> std::result::Result<google_cloud_longrunning::model::ListOperationsRequest, gaxi::prost::ConvertError> {
        Ok(
            google_cloud_longrunning::model::ListOperationsRequest::new()
                .set_name(self.name)
                .set_filter(self.filter)
                .set_page_size(self.page_size)
                .set_page_token(self.page_token)
                .set_return_partial_success(self.return_partial_success)
        )
    }
}

impl gaxi::prost::ToProto<ListOperationsResponse> for google_cloud_longrunning::model::ListOperationsResponse {
    type Output = ListOperationsResponse;
    fn to_proto(self) -> std::result::Result<ListOperationsResponse, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            operations: self.operations
                .into_iter()
                .map(|v| v.to_proto())
                .collect::<std::result::Result<std::vec::Vec<_>, _>>()?,
            next_page_token: self.next_page_token.to_proto()?,
            unreachable: self.unreachable
                .into_iter()
                .map(|v| v.to_proto())
                .collect::<std::result::Result<std::vec::Vec<_>, _>>()?,
        })
    }
}

impl gaxi::prost::FromProto<google_cloud_longrunning::model::ListOperationsResponse> for ListOperationsResponse {
    fn cnv(self) -> std::result::Result<google_cloud_longrunning::model::ListOperationsResponse, gaxi::prost::ConvertError> {
        Ok(
            google_cloud_longrunning::model::ListOperationsResponse::new()
                .set_operations(self.operations.into_iter().map(|v| v.cnv())
                    .collect::<std::result::Result<std::vec::Vec<_>, _>>()?)
                .set_next_page_token(self.next_page_token)
                .set_unreachable(self.unreachable.into_iter().map(|v| v.cnv())
                    .collect::<std::result::Result<std::vec::Vec<_>, _>>()?)
        )
    }
}

impl gaxi::prost::ToProto<CancelOperationRequest> for google_cloud_longrunning::model::CancelOperationRequest {
    type Output = CancelOperationRequest;
    fn to_proto(self) -> std::result::Result<CancelOperationRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<google_cloud_longrunning::model::CancelOperationRequest> for CancelOperationRequest {
    fn cnv(self) -> std::result::Result<google_cloud_longrunning::model::CancelOperationRequest, gaxi::prost::ConvertError> {
        Ok(
            google_cloud_longrunning::model::CancelOperationRequest::new()
                .set_name(self.name)
        )
    }
}

impl gaxi::prost::ToProto<DeleteOperationRequest> for google_cloud_longrunning::model::DeleteOperationRequest {
    type Output = DeleteOperationRequest;
    fn to_proto(self) -> std::result::Result<DeleteOperationRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<google_cloud_longrunning::model::DeleteOperationRequest> for DeleteOperationRequest {
    fn cnv(self) -> std::result::Result<google_cloud_longrunning::model::DeleteOperationRequest, gaxi::prost::ConvertError> {
        Ok(
            google_cloud_longrunning::model::DeleteOperationRequest::new()
                .set_name(self.name)
        )
    }
}

impl gaxi::prost::ToProto<WaitOperationRequest> for google_cloud_longrunning::model::WaitOperationRequest {
    type Output = WaitOperationRequest;
    fn to_proto(self) -> std::result::Result<WaitOperationRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            timeout: self.timeout.map(|v| v.to_proto()).transpose()?,
        })
    }
}

impl gaxi::prost::FromProto<google_cloud_longrunning::model::WaitOperationRequest> for WaitOperationRequest {
    fn cnv(self) -> std::result::Result<google_cloud_longrunning::model::WaitOperationRequest, gaxi::prost::ConvertError> {
        Ok(
            google_cloud_longrunning::model::WaitOperationRequest::new()
                .set_name(self.name)
                .set_or_clear_timeout(self.timeout.map(|v| v.cnv()).transpose()?)
        )
    }
}

impl gaxi::prost::ToProto<OperationInfo> for google_cloud_longrunning::model::OperationInfo {
    type Output = OperationInfo;
    fn to_proto(self) -> std::result::Result<OperationInfo, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            response_type: self.response_type.to_proto()?,
            metadata_type: self.metadata_type.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<google_cloud_longrunning::model::OperationInfo> for OperationInfo {
    fn cnv(self) -> std::result::Result<google_cloud_longrunning::model::OperationInfo, gaxi::prost::ConvertError> {
        Ok(
            google_cloud_longrunning::model::OperationInfo::new()
                .set_response_type(self.response_type)
                .set_metadata_type(self.metadata_type)
        )
    }
}