Пример #1
0
    def allocate_share_bandwidth(self, req=None, **kwargs):
        """ AllocateShareBandwidth - 开通共享带宽

        **Request**

        - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。
        - **Region** (str) - (Config) 地域。 参见  `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ 
        - **ChargeType** (str) - (Required) 付费方式:Year 按年,Month 按月,Dynamic 按时;
        - **Name** (str) - (Required) 共享带宽名字
        - **ShareBandwidth** (int) - (Required) 共享带宽值
        - **BwType** (str) - 共享带宽类型,ipv4或者ipv6,不传默认ipv4
        - **Quantity** (int) - 购买时长
        - **ShareBandwidthGuarantee** (int) - 共享带宽保底值(后付费)
        
        **Response**

        - **ShareBandwidthId** (str) - 共享带宽资源Id
        
        """
        d = {"ProjectId": self.config.project_id, "Region": self.config.region}
        req and d.update(req)
        d = apis.AllocateShareBandwidthRequestSchema().dumps(d)
        kwargs["max_retries"] = 0
        resp = self.invoke("AllocateShareBandwidth", d, **kwargs)
        return apis.AllocateShareBandwidthResponseSchema().loads(resp)
Пример #2
0
    def allocate_share_bandwidth(self,
                                 req: typing.Optional[dict] = None,
                                 **kwargs) -> dict:
        """AllocateShareBandwidth - 开通共享带宽

        **Request**

        - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。
        - **Region** (str) - (Config) 地域。 参见  `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_
        - **ChargeType** (str) - (Required) 付费方式:Year 按年,Month 按月,Dynamic 按时;
        - **Name** (str) - (Required) 共享带宽名字
        - **ShareBandwidth** (int) - (Required) 共享带宽值
        - **IPVersion** (str) - 共享带宽类型,IPv4或者IPv6,不传默认IPv4
        - **Quantity** (int) - 购买时长

        **Response**

        - **ShareBandwidthId** (str) - 共享带宽资源Id

        """
        # build request
        d = {
            "ProjectId": self.config.project_id,
            "Region": self.config.region,
        }
        req and d.update(req)
        d = apis.AllocateShareBandwidthRequestSchema().dumps(d)

        # build options
        kwargs["max_retries"] = 0  # ignore retry when api is not idempotent

        resp = self.invoke("AllocateShareBandwidth", d, **kwargs)
        return apis.AllocateShareBandwidthResponseSchema().loads(resp)
Пример #3
0
    def allocate_share_bandwidth(self, req=None, **kwargs):
        """ AllocateShareBandwidth - 开通共享带宽

        :param ProjectId: (Config) 项目ID。不填写为默认项目,子帐号必须填写。
        :param Region: (Config) 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
        :param ChargeType: (Required) 付费方式:Year 按年,Month 按月,Dynamic 按时;
        :param Name: (Required) 共享带宽名字
        :param ShareBandwidth: (Required) 共享带宽值
        :param Quantity: (Optional) 购买时长
        :param ShareBandwidthGuarantee: (Optional) 共享带宽保底值(后付费)
        """
        d = {"ProjectId": self.config.project_id, "Region": self.config.region}
        req and d.update(req)
        d = apis.AllocateShareBandwidthRequestSchema().dumps(d)
        kwargs["max_retries"] = 0
        resp = self.invoke("AllocateShareBandwidth", d, **kwargs)
        return apis.AllocateShareBandwidthResponseSchema().loads(resp)