github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/pkg/cloud/dashboard/src/services/requests.rs (about)

     1  // Copyright © 2021 Alibaba Group Holding Ltd.
     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  use anyhow::Error;
    16  use serde::Deserialize;
    17  use yew::{ComponentLink, callback::Callback, format::Nothing, services::fetch::{FetchTask, Request}};
    18  
    19  pub struct Image {
    20      pub name: String,
    21      pub body: String,
    22  }
    23  
    24  #[derive(Deserialize, Debug, Clone)]
    25  pub struct RegistryCatalog {
    26      pub repositories: Vec<String>,
    27  }
    28  
    29  pub struct Images {
    30      // props: Props,
    31      pub repos: Option<Vec<String>>,
    32      pub error: Option<String>,
    33      pub link: ComponentLink<Self>,
    34      pub task: Option<FetchTask>
    35  }
    36  
    37  pub fn get_image_list(callback: Callback<Result<String, Error>>) {
    38      let images_list = Request::get("https://localhost:5000/v2/_catalog")
    39          .body(Nothing)
    40          .expect("Could not build that request");
    41  }