Sha256: 655fd7c7b5bded82d8df69cd86c26697a1b91464adeb5245e6b3d5222f493b49

Contents?: true

Size: 1.67 KB

Versions: 6

Compression:

Stored size: 1.67 KB

Contents

# encoding: utf-8

require "thor"

module Doggy
  class CLI < Thor
    include Thor::Actions

    desc "pull", "Pulls objects from Datadog"
    long_desc <<-D
      Pull objects from Datadog. All objects are pulled unless the type switches
      are used.
    D

    method_option "dashboards", type: :boolean, desc: 'Pull dashboards'
    method_option "monitors",   type: :boolean, desc: 'Pull monitors'
    method_option "screens",    type: :boolean, desc: 'Pull screens'
    method_option "all",        type: :boolean, desc: 'Pull everything', aliases: '-a'

    def pull(*ids)
      CLI::Pull.new(options.dup, ids).run
    end

    desc "push", "Pushes objects to Datadog"
    long_desc <<-D
      Pushes objects to Datadog. Any objects that aren't skipped and don't have
      the marker in their title will get it as a result of a push.
    D

    method_option "dashboards", type: :boolean, desc: 'Pull dashboards'
    method_option "monitors",   type: :boolean, desc: 'Pull monitors'
    method_option "screens",    type: :boolean, desc: 'Pull screens'

    def push
      CLI::Push.new(options.dup).run
    end

    desc "mute OBJECT_ID OBJECT_ID OBJECT_ID", "Mutes monitor on DataDog"
    long_desc <<-D
      Mutes monitors on Datadog.
    D

    def mute(*ids)
      CLI::Mute.new(options.dup, ids).run
    end

    desc "unmute OBJECT_ID OBJECT_ID OBJECT_ID", "Unmutes monitor on DataDog"
    long_desc <<-D
      Unmutes monitors on datadog
    D

    def unmute(*ids)
      CLI::Unmute.new(options.dup, ids).run
    end

    desc "edit OBJECT_ID", "Edits an object"
    long_desc <<-D
      Edits an object
    D

    def edit(id)
      CLI::Edit.new(options.dup, id).run
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
doggy-2.0.22 lib/doggy/cli.rb
doggy-2.0.21 lib/doggy/cli.rb
doggy-2.0.20 lib/doggy/cli.rb
doggy-2.0.19 lib/doggy/cli.rb
doggy-2.0.18 lib/doggy/cli.rb
doggy-2.0.17 lib/doggy/cli.rb