コード例 #1
0
  def Run(self, args):
    client = api_client.GetApiClientForTrack(self.ReleaseTrack())
    priority = firewall_rules_util.ParsePriority(args.priority)

    if priority == firewall_rules_util.DEFAULT_RULE_PRIORITY:
      raise exceptions.InvalidArgumentException(
          'priority', 'The `default` can not be created, only updated.')

    action = firewall_rules_util.ParseAction(client.messages, args.action)

    rule = client.Create(priority, args.source_range, action, args.description)
    log.CreatedResource(args.priority)
    return rule
コード例 #2
0
ファイル: update.py プロジェクト: barber223/AudioApp
  def Run(self, args):
    client = api_client.GetApiClientForTrack(self.ReleaseTrack())
    priority = firewall_rules_util.ParsePriority(args.priority)
    resource = firewall_rules_util.ParseFirewallRule(client, priority)
    action = firewall_rules_util.ParseAction(client.messages, args.action)

    try:
      rule = client.Update(resource, priority, args.source_range, action,
                           args.description)
    except util.NoFieldsSpecifiedError:
      firewall_rules_util.RaiseMinArgument()

    log.UpdatedResource(priority)
    return rule
コード例 #3
0
    def Run(self, args):
        client = api_client.AppengineFirewallApiClient.GetApiClient('v1beta')
        registry = resources.REGISTRY.Clone()
        registry.RegisterApiByName('appengine', 'v1beta')

        priority = firewall_rules_util.ParsePriority(args.priority)

        if priority == firewall_rules_util.DEFAULT_RULE_PRIORITY:
            raise exceptions.InvalidArgumentException(
                'priority', 'The `default` can not be created, only updated.')

        action = firewall_rules_util.ParseAction(client.messages, args.action)

        rule = client.Create(priority, args.source_range, action,
                             args.description)
        log.CreatedResource(args.priority)
        return rule
コード例 #4
0
    def Run(self, args):
        client = api_client.AppengineFirewallApiClient.GetApiClient('v1beta')
        registry = resources.REGISTRY.Clone()
        registry.RegisterApiByName('appengine', 'v1beta')

        resource = firewall_rules_util.ParseFirewallRule(
            registry, client.project, args.priority)
        priority = firewall_rules_util.ParsePriority(args.priority)
        action = firewall_rules_util.ParseAction(client.messages, args.action)

        try:
            rule = client.Update(resource, priority, args.source_range, action,
                                 args.description)
        except util.NoFieldsSpecifiedError:
            firewall_rules_util.RaiseMinArgument()

        log.UpdatedResource(priority)
        return rule