Exemplo n.º 1
0
  def Run(self, args):
    """Returns a list of backendServiceGroupHealth objects."""
    if args.uri:
      args.uri = False
      args.format = 'value[delimiter="\n"](status.healthStatus[].instance)'

    holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
    ref = self.GetReference(holder, args)

    backend_service = client.BackendService(
        ref, compute_client=holder.client)

    return backend_service.GetHealth()
Exemplo n.º 2
0
  def Run(self, args):
    holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
    ref = flags.GLOBAL_REGIONAL_BACKEND_SERVICE_ARG.ResolveAsResource(
        args, holder.resources)

    if not args.security_policy:
      security_policy_ref = None
    else:
      security_policy_ref = self.SECURITY_POLICY_ARG.ResolveAsResource(
          args, holder.resources).SelfLink()

    backend_service = client.BackendService(ref, compute_client=holder.client)

    return backend_service.SetSecurityPolicy(
        security_policy=security_policy_ref)
Exemplo n.º 3
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        refs = self._BACKEND_SERVICE_ARG.ResolveAsResource(
            args,
            holder.resources,
            default_scope=backend_services_utils.GetDefaultScope())
        utils.PromptForDeletion(refs)

        requests = []
        for ref in refs:
            backend_service = client.BackendService(
                ref, compute_client=holder.client)
            requests.extend(backend_service.Delete(only_generate_request=True))

        errors = []
        resources = holder.client.MakeRequests(requests, errors)

        if errors:
            utils.RaiseToolException(errors)
        return resources
Exemplo n.º 4
0
 def _GetSetSecurityPolicyRequest(self, client, backend_service_ref,
                                  security_policy_ref):
   backend_service = backend_service_client.BackendService(
       backend_service_ref, compute_client=client)
   return backend_service.MakeSetSecurityPolicyRequestTuple(
       security_policy=security_policy_ref)
Exemplo n.º 5
0
 def _CreateSetSecurityPoliciesRequest(self, client, backend_service_ref,
                                       security_policy_ref):
     backend_service = backend_service_client.BackendService(
         backend_service_ref, compute_client=client)
     return backend_service.SetSecurityPolicy(
         security_policy=security_policy_ref, only_generate_request=True)