def Run(self, args):
     """Issues the request necessary for updating a backend bucket."""
     if (not self.AnyArgsSpecified(args)
             and not args.IsSpecified('signed_url_cache_max_age')
             and not args.IsSpecified('request_coalescing')
             and not self.AnyFlexibleCacheArgsSpecified(args)):
         raise exceptions.UpdatePropertyError(
             'At least one property must be modified.')
     return self.MakeRequests(args)
Example #2
0
    def ValidateArgs(self, args):
        """Validate arguments."""
        check_args = [
            args.export_custom_routes is None,
            args.import_custom_routes is None
        ]

        check_args.extend([
            args.export_subnet_routes_with_public_ip is None,
            args.import_subnet_routes_with_public_ip is None
        ])

        check_args.append(args.stack_type is None)

        if all(check_args):
            raise exceptions.UpdatePropertyError(
                'At least one property must be modified.')
  def _ValidateArgs(self, args):
    """Overrides."""

    if not any([
        args.description is not None,
        args.balancing_mode,
        args.max_utilization is not None,
        args.max_rate is not None,
        args.max_rate_per_instance is not None,
        args.max_rate_per_endpoint is not None,
        args.max_connections is not None,
        args.max_connections_per_instance is not None,
        args.max_connections_per_endpoint is not None,
        args.capacity_scaler is not None,
        args.failover is not None,
    ]):
      raise exceptions.UpdatePropertyError(
          'At least one property must be modified.')
 def _CheckMissingArgument(self, args):
     """Checks for missing argument."""
     all_args = [
         'ssl_certificates', 'proxy_header', 'backend_service',
         'ssl_policy', 'clear_ssl_policy'
     ]
     err_msg_args = [
         '[--ssl-certificates]', '[--backend-service]', '[--proxy-header]',
         '[--ssl-policy]', '[--clear-ssl-policy]'
     ]
     if self._certificate_map:
         all_args.append('certificate_map')
         err_msg_args.append('[--certificate-map]')
         all_args.append('clear_certificate_map')
         err_msg_args.append('[--clear-certificate-map]')
         all_args.append('clear_ssl_certificates')
         err_msg_args.append('[--clear-ssl-certificates]')
     if not sum(args.IsSpecified(arg) for arg in all_args):
         raise compute_exceptions.UpdatePropertyError(
             'You must specify at least one of %s or %s.' %
             (', '.join(err_msg_args[:-1]), err_msg_args[-1]))
  def _ValidateArgs(self, args):
    """Validatest that at least one field to update is specified.

    Args:
      args: The arguments given to the update-backend command.
    """

    if not any([
        args.description is not None,
        args.balancing_mode,
        args.max_utilization is not None,
        args.max_rate is not None,
        args.max_rate_per_instance is not None,
        args.max_rate_per_endpoint is not None,
        args.max_connections is not None,
        args.max_connections_per_instance is not None,
        args.max_connections_per_endpoint is not None,
        args.capacity_scaler is not None,
        args.failover is not None,
    ]):
      raise exceptions.UpdatePropertyError(
          'At least one property must be modified.')
Example #6
0
 def ValidateArgs(self, args):
     """Validate arguments."""
     if not any([
             args.IsSpecified('affinity_cookie_ttl'),
             args.IsSpecified('connection_draining_timeout'),
             args.IsSpecified('no_custom_request_headers'),
             args.IsSpecified('custom_request_header'),
             args.IsSpecified('description'),
             args.IsSpecified('enable_cdn'),
             args.IsSpecified('cache_key_include_protocol'),
             args.IsSpecified('cache_key_include_host'),
             args.IsSpecified('cache_key_include_query_string'),
             args.IsSpecified('cache_key_query_string_whitelist'),
             args.IsSpecified('cache_key_query_string_blacklist'),
             args.IsSpecified('cache_key_include_http_header'),
             args.IsSpecified('cache_key_include_named_cookie'),
             args.IsSpecified('signed_url_cache_max_age'),
             args.IsSpecified('http_health_checks'),
             args.IsSpecified('iap'),
             args.IsSpecified('port_name'),
             args.IsSpecified('protocol'),
             args.IsSpecified('security_policy'),
             args.IsSpecified('edge_security_policy'),
             args.IsSpecified('session_affinity'),
             args.IsSpecified('timeout'),
             args.IsSpecified('connection_drain_on_failover')
             if self._support_failover else False,
             args.IsSpecified('drop_traffic_if_unhealthy')
             if self._support_failover else False,
             args.IsSpecified('failover_ratio')
             if self._support_failover else False,
             args.IsSpecified('enable_logging')
             if self._support_logging else False,
             args.IsSpecified('logging_sample_rate')
             if self._support_logging else False,
             args.IsSpecified('health_checks'),
             args.IsSpecified('https_health_checks'),
             args.IsSpecified('no_health_checks'),
             args.IsSpecified('subsetting_policy')
             if self._support_subsetting else False,
             args.IsSpecified('subsetting_subset_size')
             if self._support_subsetting_subset_size else False,
             args.IsSpecified('request_coalescing'),
             args.IsSpecified('cache_mode'),
             args.IsSpecified('client_ttl'),
             args.IsSpecified('no_client_ttl'),
             args.IsSpecified('default_ttl'),
             args.IsSpecified('no_default_ttl'),
             args.IsSpecified('max_ttl'),
             args.IsSpecified('no_max_ttl'),
             args.IsSpecified('negative_caching'),
             args.IsSpecified('negative_caching_policy'),
             args.IsSpecified('no_negative_caching_policies'),
             args.IsSpecified('custom_response_header'),
             args.IsSpecified('no_custom_response_headers'),
             args.IsSpecified('serve_while_stale'),
             args.IsSpecified('no_serve_while_stale'),
             args.IsSpecified('bypass_cache_on_request_headers'),
             args.IsSpecified('no_bypass_cache_on_request_headers'),
             args.IsSpecified(
                 'connection_persistence_on_unhealthy_backends'),
             args.IsSpecified('tracking_mode'),
             args.IsSpecified('idle_timeout_sec'),
             args.IsSpecified('enable_strong_affinity')
             if self._support_strong_session_affinity else False,
             args.IsSpecified('compression_mode')
             if self._support_dynamic_compression else False,
             args.IsSpecified('service_lb_policy')
             if self._support_advanced_load_balancing else False,
             args.IsSpecified('no_service_lb_policy')
             if self._support_advanced_load_balancing else False,
             args.IsSpecified('service_bindings'),
             args.IsSpecified('no_service_bindings'),
             args.IsSpecified('locality_lb_policy')
             if self._support_weighted_lb else False
     ]):
         raise compute_exceptions.UpdatePropertyError(
             'At least one property must be modified.')