Пример #1
0
    def _process_resource(self, resource):
        model = models.AppServicePlan(location=resource['location'])

        if resource['kind'] == 'functionapp':
            self.log.info("Skipping %s, because this App Service Plan "
                          "is for Consumption Azure Functions." %
                          resource['name'])
            return

        if resource['kind'] == 'linux':
            model.reserved = True

        size = Lookup.extract(self.data.get('size'), resource)

        # get existing tier
        model.sku = models.SkuDescription()
        model.sku.tier = resource['sku']['tier']
        model.sku.name = resource['sku']['name']

        if 'size' in self.data:
            model.sku.tier = ResizePlan.get_sku_name(size)
            model.sku.name = size

        if 'count' in self.data:
            model.sku.capacity = Lookup.extract(self.data.get('count'),
                                                resource)

        try:
            self.client.app_service_plans.update(resource['resourceGroup'],
                                                 resource['name'], model)
        except models.DefaultErrorResponseException as e:
            self.log.error("Failed to resize %s.  Inner exception: %s" %
                           (resource['name'], e.inner_exception))
Пример #2
0
    def _process_resource(self, resource):
        model = models.AppServicePlan(location=resource['location'])

        if 'size' in self.data:
            size = self.data.get('size')
            model.sku = models.SkuDescription()
            model.sku.tier = ResizePlan.get_sku_name(size)
            model.sku.name = size

        if 'count' in self.data:
            model.target_worker_count = self.data.get('count')

        try:
            self.client.app_service_plans.update(resource['resourceGroup'], resource['name'], model)
        except models.DefaultErrorResponseException as e:
            self.log.error("Failed to resize %s.  Inner exception: %s" %
                           (resource['name'], e.inner_exception))
Пример #3
0
    def process_resource_set(self, plans):
        client = self.manager.get_client(
        )  # type: azure.mgmt.web.WebSiteManagementClient

        for plan in plans:
            model = models.AppServicePlan(location=plan['location'])

            if 'size' in self.data:
                size = self.data.get('size')
                model.sku = models.SkuDescription()
                model.sku.tier = ResizePlan.lookup_tier(size)
                model.sku.capacity = size[1]
                model.sku.name = size
                model.sku.family = size[0]
                model.sku.size = size

            if 'count' in self.data:
                model.target_worker_count = self.data.get('count')

            client.app_service_plans.update(plan['resourceGroup'],
                                            plan['name'], model)
Пример #4
0
    def process_resource_set(self, plans):
        client = self.manager.get_client(
        )  # type: azure.mgmt.web.WebSiteManagementClient

        for plan in plans:
            model = models.AppServicePlan(location=plan['location'])

            if 'size' in self.data:
                size = self.data.get('size')
                model.sku = models.SkuDescription()
                model.sku.tier = ResizePlan.get_sku_name(size)
                model.sku.name = size

            if 'count' in self.data:
                model.target_worker_count = self.data.get('count')

            try:
                client.app_service_plans.update(plan['resourceGroup'],
                                                plan['name'], model)
            except models.DefaultErrorResponseException as e:
                self.log.error("Failed to resize %s.  Inner exception: %s" %
                               (plan['name'], e.inner_exception))
                raise