Exemplo n.º 1
0
    def Run(self, args):
        client = channels.NotificationChannelsClient()
        messages = client.messages

        channel = util.GetNotificationChannelFromArgs(args, messages)

        if args.user_labels:
            channel.userLabels = util.ParseCreateLabels(
                args.user_labels, messages.NotificationChannel.UserLabelsValue)
        if args.channel_labels:
            channel.labels = util.ParseCreateLabels(
                args.channel_labels, messages.NotificationChannel.LabelsValue)

        project_ref = (projects_util.ParseProject(
            properties.VALUES.core.project.Get()))

        result = client.Create(project_ref, channel)
        log.CreatedResource(result.name, 'notification channel')
        return result
Exemplo n.º 2
0
    def Run(self, args):
        client = policies.AlertPolicyClient()
        messages = client.messages
        policy = util.CreateAlertPolicyFromArgs(args, client.messages)

        if args.user_labels:
            policy.userLabels = util.ParseCreateLabels(
                args.user_labels, messages.AlertPolicy.UserLabelsValue)

        project_ref = (projects_util.ParseProject(
            properties.VALUES.core.project.Get()))

        result = client.Create(project_ref, policy)
        log.CreatedResource(result.name, 'alert policy')
        return result