tencent_sdk/api/
vpc.rs

1use crate::{
2    Result,
3    client::RequestOptions,
4    types::vpc::{
5        CreateSubnetRequest, CreateSubnetResponse, CreateVpcRequest, CreateVpcResponse,
6        DescribeSubnetsRequest, DescribeSubnetsResponse, DescribeVpcsRequest, DescribeVpcsResponse,
7    },
8};
9
10#[cfg(feature = "async")]
11use crate::client::Client;
12
13#[cfg(feature = "async")]
14#[derive(Clone)]
15pub struct VpcService {
16    client: Client,
17}
18
19#[cfg(feature = "async")]
20impl VpcService {
21    pub(crate) fn new(client: Client) -> Self {
22        Self { client }
23    }
24
25    pub async fn describe_vpcs(
26        &self,
27        request: &DescribeVpcsRequest,
28    ) -> Result<DescribeVpcsResponse> {
29        self.client.execute(request, None).await
30    }
31
32    pub async fn describe_vpcs_with_options(
33        &self,
34        request: &DescribeVpcsRequest,
35        options: &RequestOptions,
36    ) -> Result<DescribeVpcsResponse> {
37        self.client.execute(request, Some(options)).await
38    }
39
40    pub async fn create_vpc(&self, request: &CreateVpcRequest) -> Result<CreateVpcResponse> {
41        self.client.execute(request, None).await
42    }
43
44    pub async fn create_vpc_with_options(
45        &self,
46        request: &CreateVpcRequest,
47        options: &RequestOptions,
48    ) -> Result<CreateVpcResponse> {
49        self.client.execute(request, Some(options)).await
50    }
51
52    pub async fn create_subnet(
53        &self,
54        request: &CreateSubnetRequest,
55    ) -> Result<CreateSubnetResponse> {
56        self.client.execute(request, None).await
57    }
58
59    pub async fn create_subnet_with_options(
60        &self,
61        request: &CreateSubnetRequest,
62        options: &RequestOptions,
63    ) -> Result<CreateSubnetResponse> {
64        self.client.execute(request, Some(options)).await
65    }
66
67    pub async fn describe_subnets(
68        &self,
69        request: &DescribeSubnetsRequest,
70    ) -> Result<DescribeSubnetsResponse> {
71        self.client.execute(request, None).await
72    }
73
74    pub async fn describe_subnets_with_options(
75        &self,
76        request: &DescribeSubnetsRequest,
77        options: &RequestOptions,
78    ) -> Result<DescribeSubnetsResponse> {
79        self.client.execute(request, Some(options)).await
80    }
81}
82
83#[cfg(feature = "blocking")]
84use crate::client::BlockingClient;
85
86#[cfg(feature = "blocking")]
87#[derive(Clone)]
88pub struct BlockingVpcService {
89    client: BlockingClient,
90}
91
92#[cfg(feature = "blocking")]
93impl BlockingVpcService {
94    pub(crate) fn new(client: BlockingClient) -> Self {
95        Self { client }
96    }
97
98    pub fn describe_vpcs(&self, request: &DescribeVpcsRequest) -> Result<DescribeVpcsResponse> {
99        self.client.execute(request, None)
100    }
101
102    pub fn describe_vpcs_with_options(
103        &self,
104        request: &DescribeVpcsRequest,
105        options: &RequestOptions,
106    ) -> Result<DescribeVpcsResponse> {
107        self.client.execute(request, Some(options))
108    }
109
110    pub fn create_vpc(&self, request: &CreateVpcRequest) -> Result<CreateVpcResponse> {
111        self.client.execute(request, None)
112    }
113
114    pub fn create_vpc_with_options(
115        &self,
116        request: &CreateVpcRequest,
117        options: &RequestOptions,
118    ) -> Result<CreateVpcResponse> {
119        self.client.execute(request, Some(options))
120    }
121
122    pub fn create_subnet(&self, request: &CreateSubnetRequest) -> Result<CreateSubnetResponse> {
123        self.client.execute(request, None)
124    }
125
126    pub fn create_subnet_with_options(
127        &self,
128        request: &CreateSubnetRequest,
129        options: &RequestOptions,
130    ) -> Result<CreateSubnetResponse> {
131        self.client.execute(request, Some(options))
132    }
133
134    pub fn describe_subnets(
135        &self,
136        request: &DescribeSubnetsRequest,
137    ) -> Result<DescribeSubnetsResponse> {
138        self.client.execute(request, None)
139    }
140
141    pub fn describe_subnets_with_options(
142        &self,
143        request: &DescribeSubnetsRequest,
144        options: &RequestOptions,
145    ) -> Result<DescribeSubnetsResponse> {
146        self.client.execute(request, Some(options))
147    }
148}