Sha256: 0fbec4d8fcd89375587c153ea0e6f076245c2d9b7a87bbb58b35e944ecac8607

Contents?: true

Size: 1.47 KB

Versions: 28

Compression:

Stored size: 1.47 KB

Contents

module Fog
  module Compute
    class Google
      class InstanceTemplate < Fog::Model
        identity :name

        attribute :kind
        attribute :self_link, :aliases => "selfLink"
        attribute :description
        # Properties is a hash describing the templates
        # A minimal example is
        # :properties => {
        #   :machine_type => TEST_MACHINE_TYPE,
        #   :disks => [{
        #     :boot => true,
        #     :initialize_params => {
        #       :source_image => "projects/ubuntu-os-cloud/global/images/ubuntu-1804-bionic-v20180522"}
        #     }],
        #     :network_interfaces => [{
        #       :network => "global/networks/default"
        #     }]
        #   }
        # }
        # @see https://cloud.google.com/compute/docs/reference/rest/v1/instanceTemplates/insert
        attribute :properties

        def save
          requires :name
          requires :properties

          data = service.insert_instance_template(name, properties, description)
          operation = Fog::Compute::Google::Operations.new(:service => service).get(data.name)
          operation.wait_for { ready? }
          reload
        end

        def destroy(async = true)
          requires :name
          data = service.delete_instance_template(name)
          operation = Fog::Compute::Google::Operations.new(:service => service).get(data.name)
          operation.wait_for { ready? } unless async
          operation
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
fog-google-1.24.1 lib/fog/compute/google/models/instance_template.rb
fog-google-1.24.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.23.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.22.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.21.1 lib/fog/compute/google/models/instance_template.rb
fog-google-1.21.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.20.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.19.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.18.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.17.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.16.1 lib/fog/compute/google/models/instance_template.rb
fog-google-1.16.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.15.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.14.0 lib/fog/compute/google/models/instance_template.rb
gitlab-fog-google-1.14.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.13.0 lib/fog/compute/google/models/instance_template.rb
gitlab-fog-google-1.13.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.12.1 lib/fog/compute/google/models/instance_template.rb
fog-google-1.12.0 lib/fog/compute/google/models/instance_template.rb
fog-google-1.11.0 lib/fog/compute/google/models/instance_template.rb