hexsha
stringlengths
40
40
size
int64
2
1.01M
content
stringlengths
2
1.01M
avg_line_length
float64
1.5
100
max_line_length
int64
2
1k
alphanum_fraction
float64
0.25
1
61ddb8768a31ca4d9f4b94adea9fb52822d95e90
403
require 'open-uri' require 'nokogiri' require 'pry' class Scraper def scrape_index_page(user_input) html = open("http://www.behindthename.com/name/#{user_input}") doc = Nokogiri::HTML(html) result = doc.css("div.namemain").first.text # binding.pry if result == "There was no name definition found for #{user_input.capitalize}." return false else return doc end end end
21.210526
81
0.694789
4a0bbf0e5a8ac2ea7969a64ea6d116fcf973670a
540
require "codeunion/http_client" module CodeUnion # Intent-revealing methods for interacting with Github with interfaces # that aren't tied to the api calls. class GithubAPI def initialize(access_token) @access_token = access_token @http_client = HTTPClient.new("https://api.github.com") end def create_issue(title, content, repository) @http_client.post("repos/#{repository}/issues", { "title" => title, "body" => content }, { "access_token" => @access_token }) end end end
27
72
0.67037
1ddf0e88f5954c28249620886d01faf5d2af2ce4
278
require 'spec_helper' require 'elastic/stats/naive-bayes/set' describe Elastic::Stats::NaiveBayes::Set do subject do Elastic::Stats::NaiveBayes::Set.new( 'transactions', 'training', 'category', 'subject' ) end context '#tokens' do it 'works' end end
18.533333
55
0.676259
08fcf89bfe489a1f9eb1c60e7996430662b8b333
132
class AddExtentToManifestation < ActiveRecord::Migration[4.2] def change add_column :manifestations, :extent, :text end end
22
61
0.765152
5db9d637721c510a69e0c623707d2df666f5731f
1,675
# # Author:: Seth Chisamore (<[email protected]>) # Cookbook Name:: windows # Provider:: feature_dism # # Copyright:: 2011, Opscode, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # include Chef::Provider::WindowsFeature::Base include Chef::Mixin::ShellOut include Windows::Helper def install_feature(name) # return code 3010 is valid, it indicates a reboot is required shell_out!("#{dism} /online /enable-feature /featurename:#{@new_resource.feature_name} /norestart", {:returns => [0,42,127,3010]}) end def remove_feature(name) # return code 3010 is valid, it indicates a reboot is required shell_out!("#{dism} /online /disable-feature /featurename:#{@new_resource.feature_name} /norestart", {:returns => [0,42,127,3010]}) end def installed? @installed ||= begin cmd = shell_out("#{dism} /online /Get-Features", {:returns => [0,42,127]}) cmd.stderr.empty? && (cmd.stdout =~ /^Feature Name : #{@new_resource.feature_name}.?$\n^State : Enabled.?$/i) end end private # account for File System Redirector # http://msdn.microsoft.com/en-us/library/aa384187(v=vs.85).aspx def dism @dism ||= begin locate_sysnative_cmd("dism.exe") end end
33.5
133
0.724776
f84c8bdf4c9d4a0bd59223d509152ae9b121df1e
25,528
require 'spec_helper' require 'token_helper' describe ReverseXSLT do include TokenHelper it 'has a version number' do expect(ReverseXSLT::VERSION).not_to be nil end describe '.parse_node(doc)' do let(:for_each_node) { %q[<xsl:for-each select="//a:przeprowadza_wapolnie_podmiot/a:podmiot[not(../../../.. != '')]"></xsl:for-each>] } let(:tag_node) { '<div></div>' } let(:text_node) { 'Hello World' } let(:if_node) { %q[<xsl:if test="(//a:abra != '') and (//czary:kadabra != '') and (//mary:alakazam != '')"></xsl:if>] } let(:value_of_node) { '<xsl:value-of select="//a:abra_kadabra"/>' } let(:comment_node) { '<!-- hello world -->' } let(:xml) { '<xml xmlns:xsl="http://www.w3.org/1999/XSL/Transform">%s</xml>' } it 'parses tag node' do doc = Nokogiri::XML(tag_node) ReverseXSLT.parse_node(doc.root).tap do |result| expect(result).to be_a(ReverseXSLT::Token::TagToken) expect(result.type).to be(:tag) expect(result.value).to eq('div') expect(result.children).to be_empty end end it 'parses text node' do doc = Nokogiri::XML("<div>#{text_node}</div>") ReverseXSLT.parse_node(doc.root).children.first.tap do |result| expect(result).to be_a(ReverseXSLT::Token::TextToken) expect(result.type).to be(:text) expect(result.value).to eq('Hello World') expect(result.children).to be_empty end end it 'parses xsl:value-of node' do doc = Nokogiri::XML(xml % value_of_node) ReverseXSLT.parse_node(doc.root.children.first).tap do |result| expect(result).to be_a(ReverseXSLT::Token::ValueOfToken) expect(result.type).to be(:value_of) expect(result.value).to eq('abra_kadabra') expect(result.children).to be_empty end end it 'parses xsl:if node' do doc = Nokogiri::XML(xml % if_node) ReverseXSLT.parse_node(doc.root.children.first).tap do |result| expect(result).to be_a(ReverseXSLT::Token::IfToken) expect(result.type).to be(:if) expect(result.value).to eq('if_abra_kadabra_alakazam') expect(result.children).to be_empty end end it 'parses xsl:for-each' do doc = Nokogiri::XML(xml % for_each_node) ReverseXSLT.parse_node(doc.root.children.first).tap do |result| expect(result).to be_a(ReverseXSLT::Token::ForEachToken) expect(result.type).to be(:for_each) expect(result.value).to eq('przeprowadza_wapolnie_podmiot_podmiot') expect(result.children).to be_empty end end it 'parses comments' do doc = Nokogiri::XML(comment_node) expect(ReverseXSLT.parse_node(doc.children.first)).to be_nil end it 'parses children nodes' do content = [for_each_node, if_node, comment_node, value_of_node, tag_node, text_node].join '' expected_types = [:for_each, :if, :value_of, :tag, :text] expected_classes = [ReverseXSLT::Token::ForEachToken, ReverseXSLT::Token::IfToken, ReverseXSLT::Token::ValueOfToken, ReverseXSLT::Token::TagToken, ReverseXSLT::Token::TextToken] doc = Nokogiri::XML(xml % "<div>#{content}</div>") res = ReverseXSLT.parse_node(doc.root.children.first).children res.each_with_index do |item, i| expect(item).to be_a(expected_classes[i]) expect(item.type).to eq(expected_types[i]) expect(item.children).to be_empty end end it 'parse documents without defined namespace' do content = [for_each_node, if_node, comment_node, value_of_node, tag_node, text_node].join '' doc_1 = ReverseXSLT.parse(Nokogiri::XML(xml % content).children) doc_2 = ReverseXSLT.parse(content) expect(doc_1).to eq(doc_2) end end describe '.parse(doc)' do it 'accepts nokogiri::XML as doc' do doc = Nokogiri::XML('<div></div>') res = ReverseXSLT.parse(doc) expect(res).to be_a(Array) expect(res.length).to eq(1) expect(res.first).to be_a(ReverseXSLT::Token::TagToken) end it 'accepts String as doc' do res = ReverseXSLT.parse('<div></div>') expect(res).to be_a(Array) expect(res.length).to eq(1) expect(res.first).to be_a(ReverseXSLT::Token::TagToken) end context 'doc has multiply roots' do it 'returns list of tokens' do results = ReverseXSLT.parse('<a></a><b></b><c></c>') expect(results).to be_a(Array) expect(results.length).to eq(3) %w(a b c).each_with_index do |x, i| expect(results[i]).to be_a(ReverseXSLT::Token::TagToken) expect(results[i].value).to eq(x) end end end end describe '::match?(xslt,xml)' do end describe '::match(xslt, xml)' do it 'raises error when xslt or xml has illegal format' do tag = tag_token('div') expect do ReverseXSLT.match(tag, tag) end.to raise_error(ReverseXSLT::Error::IllegalMatchUse) expect do ReverseXSLT.match(tag, [tag]) end.to raise_error(ReverseXSLT::Error::IllegalMatchUse) expect do ReverseXSLT.match([tag], tag) end.to raise_error(ReverseXSLT::Error::IllegalMatchUse) expect do ReverseXSLT.match([tag], [tag]) end.not_to raise_error end context 'using value-of-token and text-token' do it 'match duplicated value-of-token when they have the same value' do doc_1 = [value_of_token('value_1'), value_of_token('value_2')] doc_2 = [value_of_token('value'), value_of_token('value')] expect( match(doc_1, [text_token('123 124')], 'value_1' => /[0-9]+/, 'value_2' => /[0-9]+/) ).to eq({'value_1' => '123', 'value_2' => '124'}) expect { match(doc_2, [text_token('123 124')], 'value' => /[0-9]+/) }.to raise_error(ReverseXSLT::Error::DuplicatedTokenName) expect( match(doc_2, [text_token('123 123')], 'value' => /[0-9]+/) ).to eq({'value' => '123'}) end it 'match concatenated text-token and value-of-token' do doc_1 = [text_token('A'), value_of_token('number')] doc_2 = [text_token('A10')] expect(match(doc_1, doc_2)).to eq('number' => '10') end it 'doesn\'t match concatenated value-of tokens' do doc_1 = [value_of_token('char'), value_of_token('number')] doc_2 = [text_token('A10')] expect(match(doc_1, doc_2, 'number' => /[0-9]+/, 'char' => /[a-z]+/)).to eq(nil) end it 'trims whitespaces from text and matching' do expect(match([value_of_token('var')], [text_token(' a b e ')])).to eq('var' => 'a b e') expect(match([text_token('hello world ')], [text_token(" hello \n\t\r world ")])).to_not be_nil expect(match( [text_token(' hello '), value_of_token('var'), text_token(' world ')], [text_token("hello my lovely \n\nbeautiful world")] )).to eq('var' => 'my lovely beautiful') end it 'doesn\'t match empty to anything' do expect(match([], [])).to_not be_nil expect(match([], [text_token('hello')])).to be_nil expect(match([], [tag_token('div')])).to be_nil end it 'match simple value-of to text' do doc_1 = [value_of_token('var')] doc_2 = [text_token('hello world')] res = ReverseXSLT.match(doc_1, doc_2) expect(res).to be_a(Hash) expect(res['var']).to eq('hello world') end it 'match value-of+text to text' do doc_1 = [value_of_token('var'), text_token('world')] doc_2 = [text_token('hello world')] res = ReverseXSLT.match(doc_1, doc_2) expect(res).to be_a(Hash) expect(res['var']).to eq('hello') end it 'match text+value_of to text' do doc_1 = [text_token('hello'), value_of_token('var')] doc_2 = [text_token('hello world')] res = ReverseXSLT.match(doc_1, doc_2) expect(res).to be_a(Hash) expect(res['var']).to eq('world') end it 'match text+value_of+text to text' do doc_1 = [text_token('hello'), value_of_token('var'), text_token('world')] doc_2 = [text_token('hello beautiful world')] res = ReverseXSLT.match(doc_1, doc_2) expect(res).to be_a(Hash) expect(res['var']).to eq('beautiful') end it 'match value_of+text+value_of to text' do doc_1 = [value_of_token('var_a'), text_token('beautiful'), value_of_token('var_b')] doc_2 = [text_token('hello beautiful world')] res = ReverseXSLT.match(doc_1, doc_2) expect(res).to be_a(Hash) expect(res['var_a']).to eq('hello') expect(res['var_b']).to eq('world') end it 'throws error on value-of+value-of to text match' do doc_1 = [value_of_token('var_a'), value_of_token('var_b')] doc_2 = [text_token('hello world')] expect do ReverseXSLT.match(doc_1, doc_2) end.to raise_error(ReverseXSLT::Error::ConsecutiveValueOfToken) end it 'throws error on value-of to value-of match' do expect do ReverseXSLT.match([value_of_token('var_a')], [value_of_token('var_b')]) end.to raise_error(ReverseXSLT::Error::DisallowedMatch) end it 'return nil when there is no match' do doc_1 = [value_of_token('var'), text_token('hello')] doc_2 = [text_token('hello world')] expect(ReverseXSLT.match(doc_1, doc_2)).to be_nil doc_1[1] = text_token('hello world') expect(ReverseXSLT.match(doc_1, doc_2)).to_not be_nil end it 'return nil when match is not full' do doc_1 = [value_of_token('var_a'), text_token('beautiful')] doc_2 = [text_token('hello beautiful world')] expect(ReverseXSLT.match(doc_1, doc_2)).to be_nil doc_1 << value_of_token('var_b') expect(ReverseXSLT.match(doc_1, doc_2)).to_not be_nil end it 'join consecuting text tokens' do doc_1 = [text_token('hello world')] doc_2 = [text_token('hello'), text_token('world')] expect(ReverseXSLT.match(doc_1, doc_2)).to_not be_nil expect(ReverseXSLT.match(doc_2, doc_1)).to_not be_nil end it 'match value-of to text+text' do doc_1 = [value_of_token('var')] doc_2 = [text_token('hello'), text_token('world')] res = ReverseXSLT.match(doc_1, doc_2) expect(res).to be_a(Hash) expect(res['var']).to eq('hello world') end it 'allow value-of to match empty string' do doc_1 = [text_token('hello'), value_of_token('var'), text_token('world')] doc_2 = [text_token('hello world')] res = ReverseXSLT.match(doc_1, doc_2) expect(res).to be_a(Hash) expect(res['var']).to eq('') end it 'allow value-of+value-of matching when additional regexps are defined' do doc_1 = [value_of_token('count'), value_of_token('noun')] doc_2 = [text_token('127 bits')] expect do match(doc_1, doc_2) end.to raise_error(ReverseXSLT::Error::ConsecutiveValueOfToken) expect do res = match(doc_1, doc_2, 'count' => /[0-9]+/) expect(res).to eq('count' => '127', 'noun' => 'bits') end.to_not raise_error end it 'throws error on duplicated value-of token name' do doc_1 = [value_of_token('var'), text_token(':'), value_of_token('var')] doc_2 = [text_token('color: blue')] expect do match(doc_1, doc_2) end.to raise_error(ReverseXSLT::Error::DuplicatedTokenName) end it 'works on real life examples' do text_1 = %( Ogłoszenie nr <xsl:value-of select="//a:pozycja"/> - <xsl:value-of select="//a:biuletyn"/> z dnia <xsl:value-of select="//a:data_publikacji"/> r.) text_2 = %( Ogłoszenie nr 319020 - 2016 z dnia 2016-10-06 r. ) doc_1 = ReverseXSLT.parse(text_1) doc_2 = ReverseXSLT.parse(text_2) res = ReverseXSLT.match(doc_1, doc_2) expect(res).to be_a(Hash) expect(res.length).to eq(3) expect(res['pozycja']).to eq('319020') expect(res['biuletyn']).to eq('2016') expect(res['data_publikacji']).to eq('2016-10-06') end end context 'using value-of, text and tag tokens' do it 'match tag+value-of+tag to tag+tag' do # empty value-of production doc_1 = parse('<div></div><xsl:value-of select="var" /><span></span>') doc_2 = parse('<div></div><span></span>') expect(match(doc_1, doc_2)).to eq('var' => '') end it 'doesn\'t matched tag to text or value-of' do doc_1 = parse('hello beautiful world') doc_2 = parse('hello world') doc_3 = parse('hello <xsl:value-of select="var"/> wordl') doc_4 = parse('hello <beautiful /> world') expect(match(doc_1, doc_4)).to be_nil expect(match(doc_2, doc_4)).to be_nil expect(match(doc_3, doc_4)).to be_nil end it 'match tag only to tag' do doc_1 = [tag_token('div')] expect(ReverseXSLT.match(doc_1, [tag_token('div')])).to be_a(Hash) expect(ReverseXSLT.match(doc_1, [tag_token('span')])).to be_nil expect(ReverseXSLT.match(doc_1, [text_token('div')])).to be_nil end it 'match tag content recursivly' do doc_1 = parse('<div><a>quote of the day: <span><xsl:value-of select="var" /></span></a></div>') doc_2 = parse('<div><a>quote of the day: <span>hello world</span></a></div>') expect(match(doc_1, doc_2)).to eq('var' => 'hello world') end it 'works with real life examples' do xml_1 = %( <div> Ogłoszenie nr <xsl:value-of select="//a:pozycja"/> - <xsl:value-of select="//a:biuletyn"/> z dnia <xsl:value-of select="//a:data_publikacji"/> r. </div> <div class="headerMedium_xforms" style="text-align: center"> <xsl:value-of select="//a:zamawiajacy_miejscowosc"/> : <xsl:value-of select="//a:nazwa_nadana_zamowieniu"/> <br/> OGŁOSZENIE O ZAMÓWIENIU - <xsl:value-of select="//a:rodzaj_zamowienia"/> </div> ) xml_2 = %( <div> Ogłoszenie nr 319424 - 2016 z dnia 2016-10-07 r. </div><div class="headerMedium_xforms" style="text-align: center">Kraków: Wykonanie robót budowlanych w zakresie bieżącej konserwacji pomieszczeń budynku na os. Krakowiaków 46 w Krakowie<br /> OGŁOSZENIE O ZAMÓWIENIU - Roboty budowlane </div> ) res = match(parse(xml_1), parse(xml_2)) expect(res).to eq('pozycja' => '319424', 'biuletyn' => '2016', 'data_publikacji' => '2016-10-07', 'zamawiajacy_miejscowosc' => 'Kraków', 'nazwa_nadana_zamowieniu' => 'Wykonanie robót budowlanych w zakresie bieżącej konserwacji pomieszczeń budynku na os. Krakowiaków 46 w Krakowie', 'rodzaj_zamowienia' => 'Roboty budowlane') end end context 'using if-token' do it 'works with nested if-token' do pending doc_1 = [if_token('v1'){[if_token('v2'){[text_token('test')]}, text_token(',')]}] res = match(doc_1, [text_token('test,')]) expect(res).to be_a(Hash) expect(res['v1']).to eq('test,') end it 'allows to match or not given content' do doc_1 = [if_token('var') { [tag_token('div')] }] expect(match([], [tag_token('span')])).to be_nil expect(match(doc_1, [])).to_not be_nil expect(match(doc_1, [tag_token('div')])).to_not be_nil expect(match(doc_1, [tag_token('span')])).to be_nil end it 'does simple matching' do doc_1 = [ text_token('count:'), if_token('var') { [value_of_token('count'), text_token('users')] }, text_token('here') ] expect(match([text_token('count:'), text_token('here')], [text_token('count: here')])).to_not be_nil expect(match(doc_1, [text_token('count: here')])).to_not be_nil expect(match([text_token('count:'), value_of_token('count'), text_token('users'), text_token('here')], [text_token('count: 42 users here')])).to_not be_nil expect(match(doc_1, [text_token('count: 42 users here')])).to_not be_nil end it 'does simple matching and store if-token matching' do doc_1 = [ text_token('count:'), if_token('var') { [value_of_token('count'), text_token('users')] }, text_token('here') ] exp = { 'var' => '42 users', 'count' => '42' } expect(match(doc_1, [text_token('count: 42 users here')])).to eq(exp) end it 'raise error when match multiple if-token with the same name' do doc_1 = [ if_token('var') { [text_token('red')] }, tag_token('div'), if_token('var') { [text_token('red')] } ] expect do match(doc_1, parse('red<div></div>red')) end.to raise_error(ReverseXSLT::Error::DuplicatedTokenName) expect do match(doc_1, parse('red<div></div>')) match(doc_1, parse('<div></div>')) match(doc_1, parse('<div></div>red')) end.to_not raise_error end it 'can simulate case statement' do doc_1 = [ text_token('color:'), if_token('var') { [text_token('red')] }, if_token('var') { [text_token('green')] }, if_token('var') { [text_token('blue')] } ] expect(match(doc_1, [text_token('color: red')])).to eq('var' => 'red') expect(match(doc_1, [text_token('color: green')])).to eq('var' => 'green') expect(match(doc_1, [text_token('color: blue')])).to eq('var' => 'blue') expect(match(doc_1, [text_token('color: yellow')])).to be_nil end it 'runs at the same level' do doc_1 = [ if_token('var') { [tag_token('div')] } ] expect(match(doc_1, [tag_token('div')])).to_not be nil end it 'simulate POST problem (PCP)' it 'works with real life examples' do xml_1 = %( <div> <xsl:if test="(//a:pozycja != '') and (//a:data_publikacji != '') and (//a:biuletyn != '')"> Ogłoszenie nr <xsl:value-of select="//a:pozycja"/> - <xsl:value-of select="//a:biuletyn"/> z dnia <xsl:value-of select="//a:data_publikacji"/> r. </xsl:if> </div> <div class="headerMedium_xforms" style="text-align: center"> <xsl:value-of select="//a:zamawiajacy_miejscowosc"/> : <xsl:value-of select="//a:nazwa_nadana_zamowieniu"/> <br/> OGŁOSZENIE O ZAMÓWIENIU - <xsl:if test="//a:rodzaj_zamowienia = '0'">Roboty budowlane</xsl:if> <xsl:if test="//a:rodzaj_zamowienia = '1'">Dostawy</xsl:if> <xsl:if test="//a:rodzaj_zamowienia = '2'">Usługi</xsl:if> </div> <div> <b>Zamieszczanie ogłoszenia:</b> <xsl:if test="//a:zamieszczanie_obowiazkowe = '1'">obowiązkowe</xsl:if> <xsl:if test="//a:zamieszczanie_obowiazkowe != '1'">nieobowiązkowe</xsl:if> </div> ) xml_2 = %( <div> Ogłoszenie nr 319424 - 2016 z dnia 2016-10-07 r. </div><div class="headerMedium_xforms" style="text-align: center">Kraków: Wykonanie robót budowlanych w zakresie bieżącej konserwacji pomieszczeń budynku na os. Krakowiaków 46 w Krakowie<br /> OGŁOSZENIE O ZAMÓWIENIU - Roboty budowlane </div><div><b>Zamieszczanie ogłoszenia:</b> obowiązkowe </div> ) res = match(parse(xml_1), parse(xml_2)) expect(res).to eq('if_zamieszczanie_obowiazkowe' => 'obowiązkowe', 'if_rodzaj_zamowienia' => 'Roboty budowlane', 'pozycja' => '319424', 'biuletyn' => '2016', 'data_publikacji' => '2016-10-07', 'zamawiajacy_miejscowosc' => 'Kraków', 'nazwa_nadana_zamowieniu' => 'Wykonanie robót budowlanych w zakresie bieżącej konserwacji pomieszczeń budynku na os. Krakowiaków 46 w Krakowie', 'if_pozycja_data_publikacji_biuletyn' => "Ogłoszenie nr 319424 - 2016 z dnia 2016-10-07 r.") end end context 'using for-each-token' do it 'match zero occurence of for-each-token' do doc_1 = [for_each_token('numbers') { [value_of_token('number')] }] doc_2 = [text_token('')] expect(match(doc_1, doc_2)).to eq('numbers' => []) end it 'match multiple occurence of text-token' do doc_1 = [for_each_token('worlds') { [text_token('world')] }] doc_2 = [text_token(' world world world world world world ')] res = match(doc_1, doc_2) expect(res).to_not be_nil expect(res['worlds']).to be_a(Array) expect(res['worlds'].length).to eq(6) (0..5).each do |i| expect(res['worlds'][i]).to eq({}) end end it 'should match as few occurence of for-each-token as possible' do doc_1 = [for_each_token('var') { [value_of_token('number')] }] doc_1_1 = [value_of_token('a')] doc_1_2 = [value_of_token('a'), value_of_token('b')] doc_2 = [text_token('0123456789')] expect(match(doc_1_1, doc_2, 'a' => /[0-9]+/)).to eq('a' => '0123456789') res = match(doc_1, doc_2, 'number' => /[0-9]+/) expect(res).to be_a(Hash) expect(res['var'].length).to eq(1) expect(res['var'][0]).to eq('number' => '0123456789') expect(match(doc_1_2, doc_2, 'a' => /[0-9]+/, 'b' => /[0-9]+/)).to eq(nil) end it 'match multiple occurence of value-of-token' do doc_1 = [for_each_token('var') { [value_of_token('number')] }] doc_2 = [text_token(' 0 12 345 6789 ')] res = match(doc_1, doc_2, 'number' => /[0-9]+/) expect(res).to be_a(Hash) expect(res['var'][0]).to eq('number' => '0') expect(res['var'][1]).to eq('number' => '12') expect(res['var'][2]).to eq('number' => '345') expect(res['var'][3]).to eq('number' => '6789') end it 'match multiple occurence of text and if tokens' do doc_1 = [for_each_token('var') do [ value_of_token('number'), if_token('comma') { [text_token(',')] } ] end] doc_2 = [text_token(' 123, 124 ,125, 1000 ')] expect do match(doc_1, doc_2) end.to raise_error(ReverseXSLT::Error::AmbiguousMatch) expect do res = match(doc_1, doc_2, 'number' => /[0-9]+/) expect(res).to be_a(Hash) expect(res['var']).to be_a(Array) expect(res['var'][0]['number']).to eq('123') expect(res['var'][1]['number']).to eq('124') expect(res['var'][2]['number']).to eq('125') expect(res['var'][3]['number']).to eq('1000') end.to_not raise_error end it 'should end dead branches as fast as possible' end describe '.extract_text' do it 'extracts text from text-token' do doc_1 = [if_token('test') { [text_token('text') ]}] res = match(doc_1, [text_token('text')]) expect(res['test']).to eq('text') end it 'extracts text from value-of-token' do doc_1 = [if_token('test') { [value_of_token('text') ]}] res = match(doc_1, [text_token('text')]) expect(res['test']).to eq('text') end it 'extracts text from if-token' do pending doc_1 = [if_token('test') { [if_token('text'){ [text_token('text')]}, text_token(',')]}] res = match(doc_1, [text_token('text,')]) puts res.inspect expect(res['test']).to eq('text,') res = match(doc_1, [text_token(',')]) expect(res['test']).to eq(',') end # it end context 'works on real life examples' do require 'open-uri' it 'document type 406' do doc = Nokogiri::XML(open('http://crd.uzp.gov.pl/406/styl.xslt')) xml = doc.at('body') doc_2 = Nokogiri::XML(open('http://bzp.uzp.gov.pl/Out/Browser.aspx?id=7939f6a3-9153-4931-b1c2-f986cb5240f9&path=2016%5c10%5c20161017%5c324700_2016.html')) html = doc_2.css('body body').first xml = ReverseXSLT::parse(xml) html = ReverseXSLT::parse(html) html.shift until (html.first.is_a?(ReverseXSLT::Token::TagToken) and html.first.value == 'div') res = match(xml, html) puts "\033[1;34m" puts res puts "\033[0m" expect(res).to be_a(Hash) expect(res['pozycja']).to eq('324700') expect(res['zamowienie_bylo_przedmiotem_ogloszenia_numer']).to eq('324696') expect(res['zmiany_w_ogloszeniu_edycja_zmiana']).to be_an(Array) end end end end
34.969863
202
0.57388
280f2924f3d4280cbdde2568d82fdfa762c8b64f
788
class OsmPbf < Formula desc "Tools related to PBF (an alternative to XML format)" homepage "https://wiki.openstreetmap.org/wiki/PBF_Format" url "https://github.com/scrosby/OSM-binary/archive/v1.3.3.tar.gz" sha256 "a109f338ce6a8438a8faae4627cd08599d0403b8977c185499de5c17b92d0798" revision 4 bottle do cellar :any_skip_relocation sha256 "5a8c5f67cbaf2fca7171faeeeafd535fe16f5f1cb3399bed97e67c371b2cdf7b" => :sierra sha256 "c38b6254cdbb12ab370e807d8c6dcd756e081ab95b684ea5efad449238e52f00" => :el_capitan sha256 "2aa7a626188511fe06efa26f99b6d438391c7299ce7026ca08fa4c4069d6cc03" => :yosemite end depends_on "protobuf" def install cd "src" do system "make" lib.install "libosmpbf.a" end include.install Dir["include/*"] end end
31.52
92
0.769036
bf1d05e7c96b2d29f513a491c378ca24ce08d4e8
124
require 'test_helper' class ApiVersionTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
15.5
46
0.709677
ed371dcfd4f5ce10c94d9e9c8d5fe4a409176bba
397
class RenderComponent < HyperComponent param :component_name param :random_key before_update { @errors = false } after_error do |error, info| puts "error = #{error}" puts "info = #{info}" @errors = true end render do return if @errors Hyperstack::Component::ReactAPI.create_element( Module.const_get(@ComponentName), key: @RandomKey ) end end
18.904762
51
0.65995
d51112be01c3d75ec3c2df218265ea2d295ea88a
204
class CreateReviews < ActiveRecord::Migration def change create_table :reviews do |t| t.string :name t.string :email t.text :text t.timestamps null: false end end end
17
45
0.642157
03ac01a0abf91cdbd4a9051a99fb97b03a6d014e
5,686
# -*- encoding : ascii-8bit -*- require 'test_helper' class StateTest < Minitest::Test include Ethereum run_fixtures "StateTests", except: /stQuadraticComplexityTest|stMemoryStressTest|stPreCompiledContractsTransaction/ def on_fixture_test(name, data) config_overrides = get_config_overrides(name) check_state_test data, config_overrides end def check_state_test(params, config_overrides={}) run_state_test params, :verify, config_overrides end ENV_KEYS = %w(currentGasLimit currentTimestamp previousHash currentCoinbase currentDifficulty currentNumber).sort.freeze PRE_KEYS = %w(code nonce balance storage).sort.freeze def run_state_test(params, mode, config_overrides={}) pre = params['pre'] exek = params['transaction'] env = params['env'] assert_equal ENV_KEYS, env.keys.sort assert_equal 40, env['currentCoinbase'].size # setup env db_env = Env.new DB::EphemDB.new, config: Env::DEFAULT_CONFIG.merge(config_overrides) header = BlockHeader.new( prevhash: decode_hex(env['previousHash']), number: parse_int_or_hex(env['currentNumber']), coinbase: decode_hex(env['currentCoinbase']), difficulty: parse_int_or_hex(env['currentDifficulty']), timestamp: parse_int_or_hex(env['currentTimestamp']), gas_limit: [db_env.config[:max_gas_limit], parse_int_or_hex(env['currentGasLimit'])].min # work around https://github.com/ethereum/pyethereum/issues/390, step 1 ) blk = Block.new(header, env: db_env) # work around https://github.com/ethereum/pyethereum/issues/390, step 2 blk.gas_limit = parse_int_or_hex env['currentGasLimit'] # setup state pre.each do |addr, h| assert_equal 40, addr.size assert PRE_KEYS, h.keys.sort address = decode_hex addr blk.set_nonce address, parse_int_or_hex(h['nonce']) blk.set_balance address, parse_int_or_hex(h['balance']) blk.set_code address, decode_hex(h['code'][2..-1]) h['storage'].each do |k, v| blk.set_storage_data( address, Utils.big_endian_to_int(decode_hex(k[2..-1])), Utils.big_endian_to_int(decode_hex(v[2..-1])) ) end end # verify state pre.each do |addr, h| address = decode_hex addr assert_equal parse_int_or_hex(h['nonce']), blk.get_nonce(address) assert_equal parse_int_or_hex(h['balance']), blk.get_balance(address) assert_equal decode_hex(h['code'][2..-1]), blk.get_code(address) h['storage'].each do |k, v| assert_equal Utils.big_endian_to_int(decode_hex(v[2..-1])), blk.get_storage_data(address, Utils.big_endian_to_int(decode_hex(k[2..-1]))) end end # execute transactions patch_external_call blk begin tx = Transaction.new( nonce: parse_int_or_hex(exek['nonce'] || '0'), gasprice: parse_int_or_hex(exek['gasPrice'] || '0'), startgas: parse_int_or_hex(exek['gasLimit'] || '0'), to: Utils.normalize_address(exek['to'], allow_blank: true), value: parse_int_or_hex(exek['value'] || '0'), data: decode_hex(Utils.remove_0x_head(exek['data'])) ) rescue InvalidTransaction tx = nil success, output = false, Constant::BYTE_EMPTY time_pre = Time.now time_post = time_pre else if exek.has_key?('secretKey') tx.sign(exek['secretKey']) elsif %w(v r s).all? {|k| exek.has_key?(k) } tx.v = decode_hex Utils.remove_0x_head(exek['v']) tx.r = decode_hex Utils.remove_0x_head(exek['r']) tx.s = decode_hex Utils.remove_0x_head(exek['s']) else assert false, 'no way to sign' end time_pre = Time.now begin success, output = blk.apply_transaction(tx) blk.commit_state rescue InvalidTransaction success, output = false, Constant::BYTE_EMPTY blk.commit_state end time_post = Time.now if tx.to == Constant::BYTE_EMPTY output = blk.get_code(output) end end params2 = Marshal.load Marshal.dump(params) params2['logs'] = blk.get_receipt(0).logs.map {|log| log.to_h } if success.true? params2['out'] = "0x#{encode_hex(output)}" params2['post'] = Marshal.load Marshal.dump(blk.to_h(with_state: true)[:state]) params2['postStateRoot'] = encode_hex blk.state.root_hash case mode when :fill params2 when :verify params1 = Marshal.load Marshal.dump(params) shouldbe, reallyis = params1['post'], params2['post'] compare_post_states shouldbe, reallyis %w(pre exec env callcreates out gas logs postStateRoot).each do |k| shouldbe = params1[k] reallyis = stringify_possible_keys params2[k] if k == 'out' && shouldbe[0] == '#' reallyis = "##{(reallyis.size-2)/2}" end if shouldbe != reallyis raise "Mismatch: #{k}:\n shouldbe #{shouldbe}\n reallyis #{reallyis}" end end when :time time_post - time_pre end end def patch_external_call(blk) class <<blk def build_external_call(tx) blk = self apply_msg = lambda do |msg, code=nil| block_hash = lambda do |n| h = n >= blk.number || n < blk.number - 256 ? Ethereum::Constant::BYTE_EMPTY : Ethereum::Utils.keccak256(n.to_s) Ethereum::Utils.big_endian_to_int(h) end singleton_class.send :define_method, :block_hash, &block_hash super(msg, code) end super(tx).tap do |ec| ec.singleton_class.send :define_method, :apply_msg, &apply_msg end end end end end
32.678161
166
0.646852
39136610f32d6961a7b42afaf98ebca7adac945f
4,442
# frozen_string_literal: true require 'httparty' require_relative 'api' # https://api.darwinex.com/store/apis/info?name=DarwinInfoAPI&version=2.0&provider=admin#/ module Darwinex::Api class InfoApi < Api BASE_URI = 'https://api.darwinex.com/darwininfo/2.0' base_uri BASE_URI def initialize(config:, logger:) super(logger) @config = config end def list_products(status: nil, page: nil, per_page: nil) query = { query: { status: status, page: page, per_page: per_page } } send('get', '/products', options.merge(query), max_retries: config.max_retries) end def get_candles(product_name, resolution: nil, from:, to:) query = { query: { resolution: resolution, from: from, to: to } } send('get', "/products/#{product_name}/candles", options.merge(query), max_retries: config.max_retries) end def get_dxscore(product_name) send('get', "/products/#{product_name}/dxscore", options, max_retries: config.max_retries) end def get_badges(product_name) send('get', "/products/#{product_name}/history/badges", options, max_retries: config.max_retries) end def get_close_strategy(product_name) send('get', "/products/#{product_name}/history/closestrategy", options, max_retries: config.max_retries) end def get_duration_consistency(product_name) send('get', "/products/#{product_name}/history/durationconsistency", options, max_retries: config.max_retries) end def get_experience(product_name) send('get', "/products/#{product_name}/history/experience", options, max_retries: config.max_retries) end def get_losing_consistency(product_name) send('get', "/products/#{product_name}/history/losingconsistency", options, max_retries: config.max_retries) end def get_market_correlation(product_name) send('get', "/products/#{product_name}/history/marketcorrelation", options, max_retries: config.max_retries) end def get_performance(product_name) send('get', "/products/#{product_name}/history/performance", options, max_retries: config.max_retries) end def get_open_strategy(product_name) send('get', "/products/#{product_name}/history/openstrategy", options, max_retries: config.max_retries) end def get_capacity(product_name) send('get', "/products/#{product_name}/history/capacity", options, max_retries: config.max_retries) end def get_quotes(product_name, from: nil, to: nil) query = { query: { start: from, end: to } } send('get', "/products/#{product_name}/history/quotes", options.merge(query), max_retries: config.max_retries) end def get_risk_adjustment(product_name) send('get', "/products/#{product_name}/history/riskadjustment", options, max_retries: config.max_retries) end def get_risk_stability(product_name) send('get', "/products/#{product_name}/history/riskstability", options, max_retries: config.max_retries) end def get_winning_consistency(product_name) send('get', "/products/#{product_name}/history/winningconsistency", options, max_retries: config.max_retries) end def get_order_divergence(product_name) send('get', "/products/#{product_name}/history/orderdivergence", options, max_retries: config.max_retries) end def get_return_divergence(product_name) send('get', "/products/#{product_name}/history/returndivergence", options, max_retries: config.max_retries) end def get_monthly_divergence(product_name) send('get', "/products/#{product_name}/monthlydivergence", options, max_retries: config.max_retries) end def get_product_status(product_name) send('get', "/products/#{product_name}/status", options, max_retries: config.max_retries) end def get_product_scores(product_name) send('get', "/products/#{product_name}/scores", options, max_retries: config.max_retries) end def get_product_scores_badge(product_name, badge) send('get', "/products/#{product_name}/scores/#{badge}", options, max_retries: config.max_retries) end private attr_reader :config def options { headers: { Authorization: "Bearer #{config.access_token}" } } end end end
31.062937
116
0.682575
ab073c832b3935c2bf6c9c1d4a8624910187ed8a
1,615
namespace :release do desc "Release of version RELEASE_VERSION in staging of the full CTA system" task :"cta:staging" => [:"login:staging"] do puts "Initiating CTA release to staging" Rake::Task["deploy:cta:staging"].invoke end desc "Release of the tier metadata to staging" task :"tier_metadata:staging" => [:"login:staging"] do puts "Initiating CTA tier metadata release to staging" Rake::Task["deploy:tier_metadata:staging"].invoke end desc "Release of the availability configuration to staging" task :"availability:staging" => [:"login:staging"] do puts "Initiating CTA availability configuration release to staging" Rake::Task["deploy:availability:staging"].invoke end desc "Release of the local messages to staging" task :"local_messages:staging" => [:"login:staging"] do puts "Initiating CTA local messages release to staging" Rake::Task["deploy:local_messages:staging"].invoke end desc "Release of the analytics system to staging" task :"analytics:staging" => [:"login:staging"] do puts "Initiating CTA analytics release to staging" Rake::Task["deploy:analytics:staging"].invoke end desc "Release of the analytics system to aa-staging" task :"analytics:aa-staging" => [:"login:aa-staging"] do puts "Initiating CTA analytics release to aa-staging" Rake::Task["deploy:analytics:aa-staging"].invoke end desc "Release of the public dashboard to staging" task :"pubdash:staging" => [:"login:staging"] do puts "Initiating CTA public dashboard release to staging" Rake::Task["deploy:pubdash:staging"].invoke end end
42.5
77
0.725077
d55c9ba3f74b54a86fd369cc10cd95bc820379a6
459
namespace :tokens do desc "Removes expired committee member tokens from db." task remove_expired: :environment do expired_tokens = CommitteeMemberToken.where("token_created_on <= ? ", (Date.today - 2.years)) expired_tokens_count = expired_tokens.count CommitteeMemberToken.destroy(expired_tokens.map(&:id)) Rails.logger.info("Removed #{expired_tokens_count} expired committee member #{'token'.pluralize(expired_tokens_count)}.") end end
45.9
125
0.766885
399ad54d88fa55018c41552f1aafaeba1270af3e
430
require 'rails_helper' # Specs in this file have access to a helper object that includes # the BlogsHelper. For example: # # describe BlogsHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # end # end RSpec.describe BlogsHelper, type: :helper do pending "add some examples to (or delete) #{__FILE__}" end
26.875
71
0.704651
ab627772dfa1aabfd48cbcf2ffa0e69768bd46bd
216,918
# WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE require 'seahorse/client/plugins/content_length.rb' require 'aws-sdk-core/plugins/credentials_configuration.rb' require 'aws-sdk-core/plugins/logging.rb' require 'aws-sdk-core/plugins/param_converter.rb' require 'aws-sdk-core/plugins/param_validator.rb' require 'aws-sdk-core/plugins/user_agent.rb' require 'aws-sdk-core/plugins/helpful_socket_errors.rb' require 'aws-sdk-core/plugins/retry_errors.rb' require 'aws-sdk-core/plugins/global_configuration.rb' require 'aws-sdk-core/plugins/regional_endpoint.rb' require 'aws-sdk-core/plugins/response_paging.rb' require 'aws-sdk-core/plugins/stub_responses.rb' require 'aws-sdk-core/plugins/idempotency_token.rb' require 'aws-sdk-core/plugins/jsonvalue_converter.rb' require 'aws-sdk-core/plugins/client_metrics_plugin.rb' require 'aws-sdk-core/plugins/client_metrics_send_plugin.rb' require 'aws-sdk-core/plugins/signature_v4.rb' require 'aws-sdk-core/plugins/protocols/json_rpc.rb' Aws::Plugins::GlobalConfiguration.add_identifier(:storagegateway) module Aws::StorageGateway class Client < Seahorse::Client::Base include Aws::ClientStubs @identifier = :storagegateway set_api(ClientApi::API) add_plugin(Seahorse::Client::Plugins::ContentLength) add_plugin(Aws::Plugins::CredentialsConfiguration) add_plugin(Aws::Plugins::Logging) add_plugin(Aws::Plugins::ParamConverter) add_plugin(Aws::Plugins::ParamValidator) add_plugin(Aws::Plugins::UserAgent) add_plugin(Aws::Plugins::HelpfulSocketErrors) add_plugin(Aws::Plugins::RetryErrors) add_plugin(Aws::Plugins::GlobalConfiguration) add_plugin(Aws::Plugins::RegionalEndpoint) add_plugin(Aws::Plugins::ResponsePaging) add_plugin(Aws::Plugins::StubResponses) add_plugin(Aws::Plugins::IdempotencyToken) add_plugin(Aws::Plugins::JsonvalueConverter) add_plugin(Aws::Plugins::ClientMetricsPlugin) add_plugin(Aws::Plugins::ClientMetricsSendPlugin) add_plugin(Aws::Plugins::SignatureV4) add_plugin(Aws::Plugins::Protocols::JsonRpc) # @overload initialize(options) # @param [Hash] options # @option options [required, Aws::CredentialProvider] :credentials # Your AWS credentials. This can be an instance of any one of the # following classes: # # * `Aws::Credentials` - Used for configuring static, non-refreshing # credentials. # # * `Aws::InstanceProfileCredentials` - Used for loading credentials # from an EC2 IMDS on an EC2 instance. # # * `Aws::SharedCredentials` - Used for loading credentials from a # shared file, such as `~/.aws/config`. # # * `Aws::AssumeRoleCredentials` - Used when you need to assume a role. # # When `:credentials` are not configured directly, the following # locations will be searched for credentials: # # * `Aws.config[:credentials]` # * The `:access_key_id`, `:secret_access_key`, and `:session_token` options. # * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'] # * `~/.aws/credentials` # * `~/.aws/config` # * EC2 IMDS instance profile - When used by default, the timeouts are # very aggressive. Construct and pass an instance of # `Aws::InstanceProfileCredentails` to enable retries and extended # timeouts. # # @option options [required, String] :region # The AWS region to connect to. The configured `:region` is # used to determine the service `:endpoint`. When not passed, # a default `:region` is search for in the following locations: # # * `Aws.config[:region]` # * `ENV['AWS_REGION']` # * `ENV['AMAZON_REGION']` # * `ENV['AWS_DEFAULT_REGION']` # * `~/.aws/credentials` # * `~/.aws/config` # # @option options [String] :access_key_id # # @option options [Boolean] :client_side_monitoring (false) # When `true`, client-side metrics will be collected for all API requests from # this client. # # @option options [String] :client_side_monitoring_client_id ("") # Allows you to provide an identifier for this client which will be attached to # all generated client side metrics. Defaults to an empty string. # # @option options [Integer] :client_side_monitoring_port (31000) # Required for publishing client metrics. The port that the client side monitoring # agent is running on, where client metrics will be published via UDP. # # @option options [Aws::ClientSideMonitoring::Publisher] :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher) # Allows you to provide a custom client-side monitoring publisher class. By default, # will use the Client Side Monitoring Agent Publisher. # # @option options [Boolean] :convert_params (true) # When `true`, an attempt is made to coerce request parameters into # the required types. # # @option options [String] :endpoint # The client endpoint is normally constructed from the `:region` # option. You should only configure an `:endpoint` when connecting # to test endpoints. This should be avalid HTTP(S) URI. # # @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default) # The log formatter. # # @option options [Symbol] :log_level (:info) # The log level to send messages to the `:logger` at. # # @option options [Logger] :logger # The Logger instance to send log messages to. If this option # is not set, logging will be disabled. # # @option options [String] :profile ("default") # Used when loading credentials from the shared credentials file # at HOME/.aws/credentials. When not specified, 'default' is used. # # @option options [Float] :retry_base_delay (0.3) # The base delay in seconds used by the default backoff function. # # @option options [Symbol] :retry_jitter (:none) # A delay randomiser function used by the default backoff function. Some predefined functions can be referenced by name - :none, :equal, :full, otherwise a Proc that takes and returns a number. # # @see https://www.awsarchitectureblog.com/2015/03/backoff.html # # @option options [Integer] :retry_limit (3) # The maximum number of times to retry failed requests. Only # ~ 500 level server errors and certain ~ 400 level client errors # are retried. Generally, these are throttling errors, data # checksum errors, networking errors, timeout errors and auth # errors from expired credentials. # # @option options [Integer] :retry_max_delay (0) # The maximum number of seconds to delay between retries (0 for no limit) used by the default backoff function. # # @option options [String] :secret_access_key # # @option options [String] :session_token # # @option options [Boolean] :simple_json (false) # Disables request parameter conversion, validation, and formatting. # Also disable response data type conversions. This option is useful # when you want to ensure the highest level of performance by # avoiding overhead of walking request parameters and response data # structures. # # When `:simple_json` is enabled, the request parameters hash must # be formatted exactly as the DynamoDB API expects. # # @option options [Boolean] :stub_responses (false) # Causes the client to return stubbed responses. By default # fake responses are generated and returned. You can specify # the response data to return or errors to raise by calling # {ClientStubs#stub_responses}. See {ClientStubs} for more information. # # ** Please note ** When response stubbing is enabled, no HTTP # requests are made, and retries are disabled. # # @option options [Boolean] :validate_params (true) # When `true`, request parameters are validated before # sending the request. # def initialize(*args) super end # @!group API Operations # Activates the gateway you previously deployed on your host. In the # activation process, you specify information such as the region you # want to use for storing snapshots or tapes, the time zone for # scheduled snapshots the gateway snapshot schedule window, an # activation key, and a name for your gateway. The activation process # also associates your gateway with your account; for more information, # see UpdateGatewayInformation. # # <note markdown="1"> You must turn on the gateway VM before you can activate your gateway. # # </note> # # @option params [required, String] :activation_key # Your gateway activation key. You can obtain the activation key by # sending an HTTP GET request with redirects enabled to the gateway IP # address (port 80). The redirect URL returned in the response provides # you the activation key for your gateway in the query string parameter # `activationKey`. It may also include other activation-related # parameters, however, these are merely defaults -- the arguments you # pass to the `ActivateGateway` API call determine the actual # configuration of your gateway. # # For more information, see # https://docs.aws.amazon.com/storagegateway/latest/userguide/get-activation-key.html # in the Storage Gateway User Guide. # # @option params [required, String] :gateway_name # The name you configured for your gateway. # # @option params [required, String] :gateway_timezone # A value that indicates the time zone you want to set for the gateway. # The time zone is of the format "GMT-hr:mm" or "GMT+hr:mm". For # example, GMT-4:00 indicates the time is 4 hours behind GMT. GMT+2:00 # indicates the time is 2 hours ahead of GMT. The time zone is used, for # example, for scheduling snapshots and your gateway's maintenance # schedule. # # @option params [required, String] :gateway_region # A value that indicates the region where you want to store your data. # The gateway region specified must be the same region as the region in # your `Host` header in the request. For more information about # available regions and endpoints for AWS Storage Gateway, see [Regions # and Endpoints][1] in the *Amazon Web Services Glossary*. # # Valid Values: "us-east-1", "us-east-2", "us-west-1", # "us-west-2", "ca-central-1", "eu-west-1", "eu-central-1", # "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", # "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1" # # # # [1]: http://docs.aws.amazon.com/general/latest/gr/rande.html#sg_region # # @option params [String] :gateway_type # A value that defines the type of gateway to activate. The type # specified is critical to all later functions of the gateway and cannot # be changed after activation. The default value is `CACHED`. # # Valid Values: "STORED", "CACHED", "VTL", "FILE\_S3" # # @option params [String] :tape_drive_type # The value that indicates the type of tape drive to use for tape # gateway. This field is optional. # # Valid Values: "IBM-ULT3580-TD5" # # @option params [String] :medium_changer_type # The value that indicates the type of medium changer to use for tape # gateway. This field is optional. # # Valid Values: "STK-L700", "AWS-Gateway-VTL" # # @return [Types::ActivateGatewayOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ActivateGatewayOutput#gateway_arn #gateway_arn} => String # # # @example Example: To activate the gateway # # # Activates the gateway you previously deployed on your host. # # resp = client.activate_gateway({ # activation_key: "29AV1-3OFV9-VVIUB-NKT0I-LRO6V", # gateway_name: "My_Gateway", # gateway_region: "us-east-1", # gateway_timezone: "GMT-12:00", # gateway_type: "STORED", # medium_changer_type: "AWS-Gateway-VTL", # tape_drive_type: "IBM-ULT3580-TD5", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B", # } # # @example Request syntax with placeholder values # # resp = client.activate_gateway({ # activation_key: "ActivationKey", # required # gateway_name: "GatewayName", # required # gateway_timezone: "GatewayTimezone", # required # gateway_region: "RegionId", # required # gateway_type: "GatewayType", # tape_drive_type: "TapeDriveType", # medium_changer_type: "MediumChangerType", # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/ActivateGateway AWS API Documentation # # @overload activate_gateway(params = {}) # @param [Hash] params ({}) def activate_gateway(params = {}, options = {}) req = build_request(:activate_gateway, params) req.send_request(options) end # Configures one or more gateway local disks as cache for a gateway. # This operation is only supported in the cached volume, tape and file # gateway type (see [Storage Gateway Concepts][1]). # # In the request, you specify the gateway Amazon Resource Name (ARN) to # which you want to add cache, and one or more disk IDs that you want to # configure as cache. # # # # [1]: http://docs.aws.amazon.com/storagegateway/latest/userguide/StorageGatewayConcepts.html # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [required, Array<String>] :disk_ids # # @return [Types::AddCacheOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::AddCacheOutput#gateway_arn #gateway_arn} => String # # # @example Example: To add a cache # # # The following example shows a request that activates a gateway-stored volume. # # resp = client.add_cache({ # disk_ids: [ # "pci-0000:03:00.0-scsi-0:0:0:0", # "pci-0000:03:00.0-scsi-0:0:1:0", # ], # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.add_cache({ # gateway_arn: "GatewayARN", # required # disk_ids: ["DiskId"], # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/AddCache AWS API Documentation # # @overload add_cache(params = {}) # @param [Hash] params ({}) def add_cache(params = {}, options = {}) req = build_request(:add_cache, params) req.send_request(options) end # Adds one or more tags to the specified resource. You use tags to add # metadata to resources, which you can use to categorize these # resources. For example, you can categorize resources by purpose, # owner, environment, or team. Each tag consists of a key and a value, # which you define. You can add tags to the following AWS Storage # Gateway resources: # # * Storage gateways of all types # # ^ # ^ # # * Storage Volumes # # ^ # ^ # # * Virtual Tapes # # ^ # # You can create a maximum of 10 tags for each resource. Virtual tapes # and storage volumes that are recovered to a new gateway maintain their # tags. # # @option params [required, String] :resource_arn # The Amazon Resource Name (ARN) of the resource you want to add tags # to. # # @option params [required, Array<Types::Tag>] :tags # The key-value pair that represents the tag you want to add to the # resource. The value can be an empty string. # # <note markdown="1"> Valid characters for key and value are letters, spaces, and numbers # representable in UTF-8 format, and the following special characters: + # - = . \_ : / @. # # </note> # # @return [Types::AddTagsToResourceOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::AddTagsToResourceOutput#resource_arn #resource_arn} => String # # # @example Example: To add tags to resource # # # Adds one or more tags to the specified resource. # # resp = client.add_tags_to_resource({ # resource_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B", # tags: [ # { # key: "Dev Gatgeway Region", # value: "East Coast", # }, # ], # }) # # resp.to_h outputs the following: # { # resource_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B", # } # # @example Request syntax with placeholder values # # resp = client.add_tags_to_resource({ # resource_arn: "ResourceARN", # required # tags: [ # required # { # key: "TagKey", # required # value: "TagValue", # required # }, # ], # }) # # @example Response structure # # resp.resource_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/AddTagsToResource AWS API Documentation # # @overload add_tags_to_resource(params = {}) # @param [Hash] params ({}) def add_tags_to_resource(params = {}, options = {}) req = build_request(:add_tags_to_resource, params) req.send_request(options) end # Configures one or more gateway local disks as upload buffer for a # specified gateway. This operation is supported for the stored volume, # cached volume and tape gateway types. # # In the request, you specify the gateway Amazon Resource Name (ARN) to # which you want to add upload buffer, and one or more disk IDs that you # want to configure as upload buffer. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [required, Array<String>] :disk_ids # # @return [Types::AddUploadBufferOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::AddUploadBufferOutput#gateway_arn #gateway_arn} => String # # # @example Example: To add upload buffer on local disk # # # Configures one or more gateway local disks as upload buffer for a specified gateway. # # resp = client.add_upload_buffer({ # disk_ids: [ # "pci-0000:03:00.0-scsi-0:0:0:0", # "pci-0000:03:00.0-scsi-0:0:1:0", # ], # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.add_upload_buffer({ # gateway_arn: "GatewayARN", # required # disk_ids: ["DiskId"], # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/AddUploadBuffer AWS API Documentation # # @overload add_upload_buffer(params = {}) # @param [Hash] params ({}) def add_upload_buffer(params = {}, options = {}) req = build_request(:add_upload_buffer, params) req.send_request(options) end # Configures one or more gateway local disks as working storage for a # gateway. This operation is only supported in the stored volume gateway # type. This operation is deprecated in cached volume API version # 20120630. Use AddUploadBuffer instead. # # <note markdown="1"> Working storage is also referred to as upload buffer. You can also use # the AddUploadBuffer operation to add upload buffer to a stored volume # gateway. # # </note> # # In the request, you specify the gateway Amazon Resource Name (ARN) to # which you want to add working storage, and one or more disk IDs that # you want to configure as working storage. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [required, Array<String>] :disk_ids # An array of strings that identify disks that are to be configured as # working storage. Each string have a minimum length of 1 and maximum # length of 300. You can get the disk IDs from the ListLocalDisks API. # # @return [Types::AddWorkingStorageOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::AddWorkingStorageOutput#gateway_arn #gateway_arn} => String # # # @example Example: To add storage on local disk # # # Configures one or more gateway local disks as working storage for a gateway. (Working storage is also referred to as # # upload buffer.) # # resp = client.add_working_storage({ # disk_ids: [ # "pci-0000:03:00.0-scsi-0:0:0:0", # "pci-0000:03:00.0-scsi-0:0:1:0", # ], # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.add_working_storage({ # gateway_arn: "GatewayARN", # required # disk_ids: ["DiskId"], # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/AddWorkingStorage AWS API Documentation # # @overload add_working_storage(params = {}) # @param [Hash] params ({}) def add_working_storage(params = {}, options = {}) req = build_request(:add_working_storage, params) req.send_request(options) end # Cancels archiving of a virtual tape to the virtual tape shelf (VTS) # after the archiving process is initiated. This operation is only # supported in the tape gateway type. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [required, String] :tape_arn # The Amazon Resource Name (ARN) of the virtual tape you want to cancel # archiving for. # # @return [Types::CancelArchivalOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CancelArchivalOutput#tape_arn #tape_arn} => String # # # @example Example: To cancel virtual tape archiving # # # Cancels archiving of a virtual tape to the virtual tape shelf (VTS) after the archiving process is initiated. # # resp = client.cancel_archival({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # tape_arn: "arn:aws:storagegateway:us-east-1:999999999999:tape/AMZN01A2A4", # }) # # resp.to_h outputs the following: # { # tape_arn: "arn:aws:storagegateway:us-east-1:999999999999:tape/AMZN01A2A4", # } # # @example Request syntax with placeholder values # # resp = client.cancel_archival({ # gateway_arn: "GatewayARN", # required # tape_arn: "TapeARN", # required # }) # # @example Response structure # # resp.tape_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/CancelArchival AWS API Documentation # # @overload cancel_archival(params = {}) # @param [Hash] params ({}) def cancel_archival(params = {}, options = {}) req = build_request(:cancel_archival, params) req.send_request(options) end # Cancels retrieval of a virtual tape from the virtual tape shelf (VTS) # to a gateway after the retrieval process is initiated. The virtual # tape is returned to the VTS. This operation is only supported in the # tape gateway type. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [required, String] :tape_arn # The Amazon Resource Name (ARN) of the virtual tape you want to cancel # retrieval for. # # @return [Types::CancelRetrievalOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CancelRetrievalOutput#tape_arn #tape_arn} => String # # # @example Example: To cancel virtual tape retrieval # # # Cancels retrieval of a virtual tape from the virtual tape shelf (VTS) to a gateway after the retrieval process is # # initiated. # # resp = client.cancel_retrieval({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # tape_arn: "arn:aws:storagegateway:us-east-1:999999999999:tape/AMZN01A2A4", # }) # # resp.to_h outputs the following: # { # tape_arn: "arn:aws:storagegateway:us-east-1:999999999999:tape/AMZN01A2A4", # } # # @example Request syntax with placeholder values # # resp = client.cancel_retrieval({ # gateway_arn: "GatewayARN", # required # tape_arn: "TapeARN", # required # }) # # @example Response structure # # resp.tape_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/CancelRetrieval AWS API Documentation # # @overload cancel_retrieval(params = {}) # @param [Hash] params ({}) def cancel_retrieval(params = {}, options = {}) req = build_request(:cancel_retrieval, params) req.send_request(options) end # Creates a cached volume on a specified cached volume gateway. This # operation is only supported in the cached volume gateway type. # # <note markdown="1"> Cache storage must be allocated to the gateway before you can create a # cached volume. Use the AddCache operation to add cache storage to a # gateway. # # </note> # # In the request, you must specify the gateway, size of the volume in # bytes, the iSCSI target name, an IP address on which to expose the # target, and a unique client token. In response, the gateway creates # the volume and returns information about it. This information includes # the volume Amazon Resource Name (ARN), its size, and the iSCSI target # ARN that initiators can use to connect to the volume target. # # Optionally, you can provide the ARN for an existing volume as the # `SourceVolumeARN` for this cached volume, which creates an exact copy # of the existing volume’s latest recovery point. The # `VolumeSizeInBytes` value must be equal to or larger than the size of # the copied volume, in bytes. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [required, Integer] :volume_size_in_bytes # The size of the volume in bytes. # # @option params [String] :snapshot_id # The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as # the new cached volume. Specify this field if you want to create the # iSCSI storage volume from a snapshot otherwise do not include this # field. To list snapshots for your account use [DescribeSnapshots][1] # in the *Amazon Elastic Compute Cloud API Reference*. # # # # [1]: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html # # @option params [required, String] :target_name # The name of the iSCSI target used by initiators to connect to the # target and as a suffix for the target ARN. For example, specifying # `TargetName` as *myvolume* results in the target ARN of # arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume. # The target name must be unique across all volumes of a gateway. # # @option params [String] :source_volume_arn # The ARN for an existing volume. Specifying this ARN makes the new # volume into an exact copy of the specified existing volume's latest # recovery point. The `VolumeSizeInBytes` value for this new volume must # be equal to or larger than the size of the existing volume, in bytes. # # @option params [required, String] :network_interface_id # The network interface of the gateway on which to expose the iSCSI # target. Only IPv4 addresses are accepted. Use # DescribeGatewayInformation to get a list of the network interfaces # available on a gateway. # # Valid Values: A valid IP address. # # @option params [required, String] :client_token # A unique identifier that you use to retry a request. If you retry a # request, use the same `ClientToken` you specified in the initial # request. # # @option params [Boolean] :kms_encrypted # True to use Amazon S3 server side encryption with your own AWS KMS # key, or false to use a key managed by Amazon S3. Optional. # # @option params [String] :kms_key # The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 # server side encryption. This value can only be set when KMSEncrypted # is true. Optional. # # @return [Types::CreateCachediSCSIVolumeOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateCachediSCSIVolumeOutput#volume_arn #volume_arn} => String # * {Types::CreateCachediSCSIVolumeOutput#target_arn #target_arn} => String # # # @example Example: To create a cached iSCSI volume # # # Creates a cached volume on a specified cached gateway. # # resp = client.create_cached_iscsi_volume({ # client_token: "cachedvol112233", # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # network_interface_id: "10.1.1.1", # snapshot_id: "snap-f47b7b94", # target_name: "my-volume", # volume_size_in_bytes: 536870912000, # }) # # resp.to_h outputs the following: # { # target_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume", # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # } # # @example Request syntax with placeholder values # # resp = client.create_cached_iscsi_volume({ # gateway_arn: "GatewayARN", # required # volume_size_in_bytes: 1, # required # snapshot_id: "SnapshotId", # target_name: "TargetName", # required # source_volume_arn: "VolumeARN", # network_interface_id: "NetworkInterfaceId", # required # client_token: "ClientToken", # required # kms_encrypted: false, # kms_key: "KMSKey", # }) # # @example Response structure # # resp.volume_arn #=> String # resp.target_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/CreateCachediSCSIVolume AWS API Documentation # # @overload create_cached_iscsi_volume(params = {}) # @param [Hash] params ({}) def create_cached_iscsi_volume(params = {}, options = {}) req = build_request(:create_cached_iscsi_volume, params) req.send_request(options) end # Creates a Network File System (NFS) file share on an existing file # gateway. In Storage Gateway, a file share is a file system mount point # backed by Amazon S3 cloud storage. Storage Gateway exposes file shares # using a NFS interface. This operation is only supported for file # gateways. # # File gateway requires AWS Security Token Service (AWS STS) to be # activated to enable you create a file share. Make sure AWS STS is # activated in the region you are creating your file gateway in. If AWS # STS is not activated in the region, activate it. For information about # how to activate AWS STS, see Activating and Deactivating AWS STS in an # AWS Region in the AWS Identity and Access Management User Guide. # # File gateway does not support creating hard or symbolic links on a # file share. # # @option params [required, String] :client_token # A unique string value that you supply that is used by file gateway to # ensure idempotent file share creation. # # @option params [Types::NFSFileShareDefaults] :nfs_file_share_defaults # File share default values. Optional. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the file gateway on which you want # to create a file share. # # @option params [Boolean] :kms_encrypted # True to use Amazon S3 server side encryption with your own AWS KMS # key, or false to use a key managed by Amazon S3. Optional. # # @option params [String] :kms_key # The Amazon Resource Name (ARN) AWS KMS key used for Amazon S3 server # side encryption. This value can only be set when KMSEncrypted is true. # Optional. # # @option params [required, String] :role # The ARN of the AWS Identity and Access Management (IAM) role that a # file gateway assumes when it accesses the underlying storage. # # @option params [required, String] :location_arn # The ARN of the backed storage used for storing file data. # # @option params [String] :default_storage_class # The default storage class for objects put into an Amazon S3 bucket by # the file gateway. Possible values are `S3_STANDARD`, `S3_STANDARD_IA`, # or `S3_ONEZONE_IA`. If this field is not populated, the default value # `S3_STANDARD` is used. Optional. # # @option params [String] :object_acl # A value that sets the access control list permission for objects in # the S3 bucket that a file gateway puts objects into. The default value # is "private". # # @option params [Array<String>] :client_list # The list of clients that are allowed to access the file gateway. The # list must contain either valid IP addresses or valid CIDR blocks. # # @option params [String] :squash # Maps a user to anonymous user. Valid options are the following: # # * `RootSquash` - Only root is mapped to anonymous user. # # * `NoSquash` - No one is mapped to anonymous user # # * `AllSquash` - Everyone is mapped to anonymous user. # # @option params [Boolean] :read_only # A value that sets the write status of a file share. This value is true # if the write status is read-only, and otherwise false. # # @option params [Boolean] :guess_mime_type_enabled # A value that enables guessing of the MIME type for uploaded objects # based on file extensions. Set this value to true to enable MIME type # guessing, and otherwise to false. The default value is true. # # @option params [Boolean] :requester_pays # A value that sets the access control list permission for objects in # the Amazon S3 bucket that a file gateway puts objects into. The # default value is `private`. # # @return [Types::CreateNFSFileShareOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateNFSFileShareOutput#file_share_arn #file_share_arn} => String # # @example Request syntax with placeholder values # # resp = client.create_nfs_file_share({ # client_token: "ClientToken", # required # nfs_file_share_defaults: { # file_mode: "PermissionMode", # directory_mode: "PermissionMode", # group_id: 1, # owner_id: 1, # }, # gateway_arn: "GatewayARN", # required # kms_encrypted: false, # kms_key: "KMSKey", # role: "Role", # required # location_arn: "LocationARN", # required # default_storage_class: "StorageClass", # object_acl: "private", # accepts private, public-read, public-read-write, authenticated-read, bucket-owner-read, bucket-owner-full-control, aws-exec-read # client_list: ["IPV4AddressCIDR"], # squash: "Squash", # read_only: false, # guess_mime_type_enabled: false, # requester_pays: false, # }) # # @example Response structure # # resp.file_share_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/CreateNFSFileShare AWS API Documentation # # @overload create_nfs_file_share(params = {}) # @param [Hash] params ({}) def create_nfs_file_share(params = {}, options = {}) req = build_request(:create_nfs_file_share, params) req.send_request(options) end # Creates a Server Message Block (SMB) file share on an existing file # gateway. In Storage Gateway, a file share is a file system mount point # backed by Amazon S3 cloud storage. Storage Gateway expose file shares # using a SMB interface. This operation is only supported for file # gateways. # # File gateways require AWS Security Token Service (AWS STS) to be # activated to enable you to create a file share. Make sure that AWS STS # is activated in the AWS Region you are creating your file gateway in. # If AWS STS is not activated in this AWS Region, activate it. For # information about how to activate AWS STS, see [Activating and # Deactivating AWS STS in an AWS Region][1] in the *AWS Identity and # Access Management User Guide.* # # File gateways don't support creating hard or symbolic links on a # file # share. # # # # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html # # @option params [required, String] :client_token # A unique string value that you supply that is used by file gateway to # ensure idempotent file share creation. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the file gateway on which you want # to create a file share. # # @option params [Boolean] :kms_encrypted # True to use Amazon S3 server side encryption with your own AWS KMS # key, or false to use a key managed by Amazon S3. Optional. # # @option params [String] :kms_key # The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 # server side encryption. This value can only be set when KMSEncrypted # is true. Optional. # # @option params [required, String] :role # The ARN of the AWS Identity and Access Management (IAM) role that a # file gateway assumes when it accesses the underlying storage. # # @option params [required, String] :location_arn # The ARN of the backed storage used for storing file data. # # @option params [String] :default_storage_class # The default storage class for objects put into an Amazon S3 bucket by # the file gateway. Possible values are `S3_STANDARD`, `S3_STANDARD_IA`, # or `S3_ONEZONE_IA`. If this field is not populated, the default value # `S3_STANDARD` is used. Optional. # # @option params [String] :object_acl # A value that sets the access control list permission for objects in # the S3 bucket that a file gateway puts objects into. The default value # is "private". # # @option params [Boolean] :read_only # A value that sets the write status of a file share. This value is true # if the write status is read-only, and otherwise false. # # @option params [Boolean] :guess_mime_type_enabled # A value that enables guessing of the MIME type for uploaded objects # based on file extensions. Set this value to true to enable MIME type # guessing, and otherwise to false. The default value is true. # # @option params [Boolean] :requester_pays # A value that sets the access control list permission for objects in # the Amazon S3 bucket that a file gateway puts objects into. The # default value is `private`. # # @option params [Array<String>] :valid_user_list # A list of users or groups in the Active Directory that are allowed to # access the file share. A group must be prefixed with the @ character. # For example `@group1`. Can only be set if Authentication is set to # `ActiveDirectory`. # # @option params [Array<String>] :invalid_user_list # A list of users or groups in the Active Directory that are not allowed # to access the file share. A group must be prefixed with the @ # character. For example `@group1`. Can only be set if Authentication is # set to `ActiveDirectory`. # # @option params [String] :authentication # The authentication method that users use to access the file share. # # Valid values are `ActiveDirectory` or `GuestAccess`. The default is # `ActiveDirectory`. # # @return [Types::CreateSMBFileShareOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateSMBFileShareOutput#file_share_arn #file_share_arn} => String # # @example Request syntax with placeholder values # # resp = client.create_smb_file_share({ # client_token: "ClientToken", # required # gateway_arn: "GatewayARN", # required # kms_encrypted: false, # kms_key: "KMSKey", # role: "Role", # required # location_arn: "LocationARN", # required # default_storage_class: "StorageClass", # object_acl: "private", # accepts private, public-read, public-read-write, authenticated-read, bucket-owner-read, bucket-owner-full-control, aws-exec-read # read_only: false, # guess_mime_type_enabled: false, # requester_pays: false, # valid_user_list: ["FileShareUser"], # invalid_user_list: ["FileShareUser"], # authentication: "Authentication", # }) # # @example Response structure # # resp.file_share_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/CreateSMBFileShare AWS API Documentation # # @overload create_smb_file_share(params = {}) # @param [Hash] params ({}) def create_smb_file_share(params = {}, options = {}) req = build_request(:create_smb_file_share, params) req.send_request(options) end # Initiates a snapshot of a volume. # # AWS Storage Gateway provides the ability to back up point-in-time # snapshots of your data to Amazon Simple Storage (S3) for durable # off-site recovery, as well as import the data to an Amazon Elastic # Block Store (EBS) volume in Amazon Elastic Compute Cloud (EC2). You # can take snapshots of your gateway volume on a scheduled or ad-hoc # basis. This API enables you to take ad-hoc snapshot. For more # information, see [Editing a Snapshot Schedule][1]. # # In the CreateSnapshot request you identify the volume by providing its # Amazon Resource Name (ARN). You must also provide description for the # snapshot. When AWS Storage Gateway takes the snapshot of specified # volume, the snapshot and description appears in the AWS Storage # Gateway Console. In response, AWS Storage Gateway returns you a # snapshot ID. You can use this snapshot ID to check the snapshot # progress or later use it when you want to create a volume from a # snapshot. This operation is only supported in stored and cached volume # gateway type. # # <note markdown="1"> To list or delete a snapshot, you must use the Amazon EC2 API. For # more information, see DescribeSnapshots or DeleteSnapshot in the [EC2 # API reference][2]. # # </note> # # Volume and snapshot IDs are changing to a longer length ID format. For # more information, see the important note on the [Welcome][3] page. # # # # [1]: http://docs.aws.amazon.com/storagegateway/latest/userguide/managing-volumes.html#SchedulingSnapshot # [2]: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Operations.html # [3]: http://docs.aws.amazon.com/storagegateway/latest/APIReference/Welcome.html # # @option params [required, String] :volume_arn # The Amazon Resource Name (ARN) of the volume. Use the ListVolumes # operation to return a list of gateway volumes. # # @option params [required, String] :snapshot_description # Textual description of the snapshot that appears in the Amazon EC2 # console, Elastic Block Store snapshots panel in the **Description** # field, and in the AWS Storage Gateway snapshot **Details** pane, # **Description** field # # @return [Types::CreateSnapshotOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateSnapshotOutput#volume_arn #volume_arn} => String # * {Types::CreateSnapshotOutput#snapshot_id #snapshot_id} => String # # # @example Example: To create a snapshot of a gateway volume # # # Initiates an ad-hoc snapshot of a gateway volume. # # resp = client.create_snapshot({ # snapshot_description: "My root volume snapshot as of 10/03/2017", # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # }) # # resp.to_h outputs the following: # { # snapshot_id: "snap-78e22663", # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # } # # @example Request syntax with placeholder values # # resp = client.create_snapshot({ # volume_arn: "VolumeARN", # required # snapshot_description: "SnapshotDescription", # required # }) # # @example Response structure # # resp.volume_arn #=> String # resp.snapshot_id #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/CreateSnapshot AWS API Documentation # # @overload create_snapshot(params = {}) # @param [Hash] params ({}) def create_snapshot(params = {}, options = {}) req = build_request(:create_snapshot, params) req.send_request(options) end # Initiates a snapshot of a gateway from a volume recovery point. This # operation is only supported in the cached volume gateway type. # # A volume recovery point is a point in time at which all data of the # volume is consistent and from which you can create a snapshot. To get # a list of volume recovery point for cached volume gateway, use # ListVolumeRecoveryPoints. # # In the `CreateSnapshotFromVolumeRecoveryPoint` request, you identify # the volume by providing its Amazon Resource Name (ARN). You must also # provide a description for the snapshot. When the gateway takes a # snapshot of the specified volume, the snapshot and its description # appear in the AWS Storage Gateway console. In response, the gateway # returns you a snapshot ID. You can use this snapshot ID to check the # snapshot progress or later use it when you want to create a volume # from a snapshot. # # <note markdown="1"> To list or delete a snapshot, you must use the Amazon EC2 API. For # more information, in *Amazon Elastic Compute Cloud API Reference*. # # </note> # # @option params [required, String] :volume_arn # # @option params [required, String] :snapshot_description # # @return [Types::CreateSnapshotFromVolumeRecoveryPointOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateSnapshotFromVolumeRecoveryPointOutput#snapshot_id #snapshot_id} => String # * {Types::CreateSnapshotFromVolumeRecoveryPointOutput#volume_arn #volume_arn} => String # * {Types::CreateSnapshotFromVolumeRecoveryPointOutput#volume_recovery_point_time #volume_recovery_point_time} => String # # # @example Example: To create a snapshot of a gateway volume # # # Initiates a snapshot of a gateway from a volume recovery point. # # resp = client.create_snapshot_from_volume_recovery_point({ # snapshot_description: "My root volume snapshot as of 2017-06-30T10:10:10.000Z", # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # }) # # resp.to_h outputs the following: # { # snapshot_id: "snap-78e22663", # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # volume_recovery_point_time: "2017-06-30T10:10:10.000Z", # } # # @example Request syntax with placeholder values # # resp = client.create_snapshot_from_volume_recovery_point({ # volume_arn: "VolumeARN", # required # snapshot_description: "SnapshotDescription", # required # }) # # @example Response structure # # resp.snapshot_id #=> String # resp.volume_arn #=> String # resp.volume_recovery_point_time #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/CreateSnapshotFromVolumeRecoveryPoint AWS API Documentation # # @overload create_snapshot_from_volume_recovery_point(params = {}) # @param [Hash] params ({}) def create_snapshot_from_volume_recovery_point(params = {}, options = {}) req = build_request(:create_snapshot_from_volume_recovery_point, params) req.send_request(options) end # Creates a volume on a specified gateway. This operation is only # supported in the stored volume gateway type. # # The size of the volume to create is inferred from the disk size. You # can choose to preserve existing data on the disk, create volume from # an existing snapshot, or create an empty volume. If you choose to # create an empty gateway volume, then any existing data on the disk is # erased. # # In the request you must specify the gateway and the disk information # on which you are creating the volume. In response, the gateway creates # the volume and returns volume information such as the volume Amazon # Resource Name (ARN), its size, and the iSCSI target ARN that # initiators can use to connect to the volume target. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [required, String] :disk_id # The unique identifier for the gateway local disk that is configured as # a stored volume. Use [ListLocalDisks][1] to list disk IDs for a # gateway. # # # # [1]: http://docs.aws.amazon.com/storagegateway/latest/userguide/API_ListLocalDisks.html # # @option params [String] :snapshot_id # The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as # the new stored volume. Specify this field if you want to create the # iSCSI storage volume from a snapshot otherwise do not include this # field. To list snapshots for your account use [DescribeSnapshots][1] # in the *Amazon Elastic Compute Cloud API Reference*. # # # # [1]: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html # # @option params [required, Boolean] :preserve_existing_data # Specify this field as true if you want to preserve the data on the # local disk. Otherwise, specifying this field as false creates an empty # volume. # # Valid Values: true, false # # @option params [required, String] :target_name # The name of the iSCSI target used by initiators to connect to the # target and as a suffix for the target ARN. For example, specifying # `TargetName` as *myvolume* results in the target ARN of # arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume. # The target name must be unique across all volumes of a gateway. # # @option params [required, String] :network_interface_id # The network interface of the gateway on which to expose the iSCSI # target. Only IPv4 addresses are accepted. Use # DescribeGatewayInformation to get a list of the network interfaces # available on a gateway. # # Valid Values: A valid IP address. # # @option params [Boolean] :kms_encrypted # True to use Amazon S3 server side encryption with your own AWS KMS # key, or false to use a key managed by Amazon S3. Optional. # # @option params [String] :kms_key # The Amazon Resource Name (ARN) of the KMS key used for Amazon S3 # server side encryption. This value can only be set when KMSEncrypted # is true. Optional. # # @return [Types::CreateStorediSCSIVolumeOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateStorediSCSIVolumeOutput#volume_arn #volume_arn} => String # * {Types::CreateStorediSCSIVolumeOutput#volume_size_in_bytes #volume_size_in_bytes} => Integer # * {Types::CreateStorediSCSIVolumeOutput#target_arn #target_arn} => String # # # @example Example: To create a stored iSCSI volume # # # Creates a stored volume on a specified stored gateway. # # resp = client.create_stored_iscsi_volume({ # disk_id: "pci-0000:03:00.0-scsi-0:0:0:0", # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # network_interface_id: "10.1.1.1", # preserve_existing_data: true, # snapshot_id: "snap-f47b7b94", # target_name: "my-volume", # }) # # resp.to_h outputs the following: # { # target_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume", # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # volume_size_in_bytes: 1099511627776, # } # # @example Request syntax with placeholder values # # resp = client.create_stored_iscsi_volume({ # gateway_arn: "GatewayARN", # required # disk_id: "DiskId", # required # snapshot_id: "SnapshotId", # preserve_existing_data: false, # required # target_name: "TargetName", # required # network_interface_id: "NetworkInterfaceId", # required # kms_encrypted: false, # kms_key: "KMSKey", # }) # # @example Response structure # # resp.volume_arn #=> String # resp.volume_size_in_bytes #=> Integer # resp.target_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/CreateStorediSCSIVolume AWS API Documentation # # @overload create_stored_iscsi_volume(params = {}) # @param [Hash] params ({}) def create_stored_iscsi_volume(params = {}, options = {}) req = build_request(:create_stored_iscsi_volume, params) req.send_request(options) end # Creates a virtual tape by using your own barcode. You write data to # the virtual tape and then archive the tape. A barcode is unique and # can not be reused if it has already been used on a tape . This applies # to barcodes used on deleted tapes. This operation is only supported in # the tape gateway type. # # <note markdown="1"> Cache storage must be allocated to the gateway before you can create a # virtual tape. Use the AddCache operation to add cache storage to a # gateway. # # </note> # # @option params [required, String] :gateway_arn # The unique Amazon Resource Name (ARN) that represents the gateway to # associate the virtual tape with. Use the ListGateways operation to # return a list of gateways for your account and region. # # @option params [required, Integer] :tape_size_in_bytes # The size, in bytes, of the virtual tape that you want to create. # # <note markdown="1"> The size must be aligned by gigabyte (1024*1024*1024 byte). # # </note> # # @option params [required, String] :tape_barcode # The barcode that you want to assign to the tape. # # <note markdown="1"> Barcodes cannot be reused. This includes barcodes used for tapes that # have been deleted. # # </note> # # @option params [Boolean] :kms_encrypted # True to use Amazon S3 server side encryption with your own AWS KMS # key, or false to use a key managed by Amazon S3. Optional. # # @option params [String] :kms_key # The Amazon Resource Name (ARN) of the AWS KMS Key used for Amazon S3 # server side encryption. This value can only be set when KMSEncrypted # is true. Optional. # # @return [Types::CreateTapeWithBarcodeOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateTapeWithBarcodeOutput#tape_arn #tape_arn} => String # # # @example Example: To create a virtual tape using a barcode # # # Creates a virtual tape by using your own barcode. # # resp = client.create_tape_with_barcode({ # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # tape_barcode: "TEST12345", # tape_size_in_bytes: 107374182400, # }) # # resp.to_h outputs the following: # { # tape_arn: "arn:aws:storagegateway:us-east-1:999999999999:tape/TEST12345", # } # # @example Request syntax with placeholder values # # resp = client.create_tape_with_barcode({ # gateway_arn: "GatewayARN", # required # tape_size_in_bytes: 1, # required # tape_barcode: "TapeBarcode", # required # kms_encrypted: false, # kms_key: "KMSKey", # }) # # @example Response structure # # resp.tape_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/CreateTapeWithBarcode AWS API Documentation # # @overload create_tape_with_barcode(params = {}) # @param [Hash] params ({}) def create_tape_with_barcode(params = {}, options = {}) req = build_request(:create_tape_with_barcode, params) req.send_request(options) end # Creates one or more virtual tapes. You write data to the virtual tapes # and then archive the tapes. This operation is only supported in the # tape gateway type. # # <note markdown="1"> Cache storage must be allocated to the gateway before you can create # virtual tapes. Use the AddCache operation to add cache storage to a # gateway. # # </note> # # @option params [required, String] :gateway_arn # The unique Amazon Resource Name (ARN) that represents the gateway to # associate the virtual tapes with. Use the ListGateways operation to # return a list of gateways for your account and region. # # @option params [required, Integer] :tape_size_in_bytes # The size, in bytes, of the virtual tapes that you want to create. # # <note markdown="1"> The size must be aligned by gigabyte (1024*1024*1024 byte). # # </note> # # @option params [required, String] :client_token # A unique identifier that you use to retry a request. If you retry a # request, use the same `ClientToken` you specified in the initial # request. # # <note markdown="1"> Using the same `ClientToken` prevents creating the tape multiple # times. # # </note> # # @option params [required, Integer] :num_tapes_to_create # The number of virtual tapes that you want to create. # # @option params [required, String] :tape_barcode_prefix # A prefix that you append to the barcode of the virtual tape you are # creating. This prefix makes the barcode unique. # # <note markdown="1"> The prefix must be 1 to 4 characters in length and must be one of the # uppercase letters from A to Z. # # </note> # # @option params [Boolean] :kms_encrypted # True to use Amazon S3 server side encryption with your own AWS KMS # key, or false to use a key managed by Amazon S3. Optional. # # @option params [String] :kms_key # The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 # server side encryption. This value can only be set when KMSEncrypted # is true. Optional. # # @return [Types::CreateTapesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateTapesOutput#tape_arns #tape_arns} => Array&lt;String&gt; # # # @example Example: To create a virtual tape # # # Creates one or more virtual tapes. # # resp = client.create_tapes({ # client_token: "77777", # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # num_tapes_to_create: 3, # tape_barcode_prefix: "TEST", # tape_size_in_bytes: 107374182400, # }) # # resp.to_h outputs the following: # { # tape_arns: [ # "arn:aws:storagegateway:us-east-1:999999999999:tape/TEST38A29D", # "arn:aws:storagegateway:us-east-1:204469490176:tape/TEST3AA29F", # "arn:aws:storagegateway:us-east-1:204469490176:tape/TEST3BA29E", # ], # } # # @example Request syntax with placeholder values # # resp = client.create_tapes({ # gateway_arn: "GatewayARN", # required # tape_size_in_bytes: 1, # required # client_token: "ClientToken", # required # num_tapes_to_create: 1, # required # tape_barcode_prefix: "TapeBarcodePrefix", # required # kms_encrypted: false, # kms_key: "KMSKey", # }) # # @example Response structure # # resp.tape_arns #=> Array # resp.tape_arns[0] #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/CreateTapes AWS API Documentation # # @overload create_tapes(params = {}) # @param [Hash] params ({}) def create_tapes(params = {}, options = {}) req = build_request(:create_tapes, params) req.send_request(options) end # Deletes the bandwidth rate limits of a gateway. You can delete either # the upload and download bandwidth rate limit, or you can delete both. # If you delete only one of the limits, the other limit remains # unchanged. To specify which gateway to work with, use the Amazon # Resource Name (ARN) of the gateway in your request. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [required, String] :bandwidth_type # One of the BandwidthType values that indicates the gateway bandwidth # rate limit to delete. # # Valid Values: `Upload`, `Download`, `All`. # # @return [Types::DeleteBandwidthRateLimitOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DeleteBandwidthRateLimitOutput#gateway_arn #gateway_arn} => String # # # @example Example: To delete bandwidth rate limits of gateway # # # Deletes the bandwidth rate limits of a gateway; either the upload or download limit, or both. # # resp = client.delete_bandwidth_rate_limit({ # bandwidth_type: "All", # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.delete_bandwidth_rate_limit({ # gateway_arn: "GatewayARN", # required # bandwidth_type: "BandwidthType", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DeleteBandwidthRateLimit AWS API Documentation # # @overload delete_bandwidth_rate_limit(params = {}) # @param [Hash] params ({}) def delete_bandwidth_rate_limit(params = {}, options = {}) req = build_request(:delete_bandwidth_rate_limit, params) req.send_request(options) end # Deletes Challenge-Handshake Authentication Protocol (CHAP) credentials # for a specified iSCSI target and initiator pair. # # @option params [required, String] :target_arn # The Amazon Resource Name (ARN) of the iSCSI volume target. Use the # DescribeStorediSCSIVolumes operation to return to retrieve the # TargetARN for specified VolumeARN. # # @option params [required, String] :initiator_name # The iSCSI initiator that connects to the target. # # @return [Types::DeleteChapCredentialsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DeleteChapCredentialsOutput#target_arn #target_arn} => String # * {Types::DeleteChapCredentialsOutput#initiator_name #initiator_name} => String # # # @example Example: To delete CHAP credentials # # # Deletes Challenge-Handshake Authentication Protocol (CHAP) credentials for a specified iSCSI target and initiator pair. # # resp = client.delete_chap_credentials({ # initiator_name: "iqn.1991-05.com.microsoft:computername.domain.example.com", # target_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume", # }) # # resp.to_h outputs the following: # { # initiator_name: "iqn.1991-05.com.microsoft:computername.domain.example.com", # target_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume", # } # # @example Request syntax with placeholder values # # resp = client.delete_chap_credentials({ # target_arn: "TargetARN", # required # initiator_name: "IqnName", # required # }) # # @example Response structure # # resp.target_arn #=> String # resp.initiator_name #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DeleteChapCredentials AWS API Documentation # # @overload delete_chap_credentials(params = {}) # @param [Hash] params ({}) def delete_chap_credentials(params = {}, options = {}) req = build_request(:delete_chap_credentials, params) req.send_request(options) end # Deletes a file share from a file gateway. This operation is only # supported for file gateways. # # @option params [required, String] :file_share_arn # The Amazon Resource Name (ARN) of the file share to be deleted. # # @option params [Boolean] :force_delete # If this value is set to true, the operation deletes a file share # immediately and aborts all data uploads to AWS. Otherwise, the file # share is not deleted until all data is uploaded to AWS. This process # aborts the data upload process, and the file share enters the # FORCE\_DELETING status. # # @return [Types::DeleteFileShareOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DeleteFileShareOutput#file_share_arn #file_share_arn} => String # # @example Request syntax with placeholder values # # resp = client.delete_file_share({ # file_share_arn: "FileShareARN", # required # force_delete: false, # }) # # @example Response structure # # resp.file_share_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DeleteFileShare AWS API Documentation # # @overload delete_file_share(params = {}) # @param [Hash] params ({}) def delete_file_share(params = {}, options = {}) req = build_request(:delete_file_share, params) req.send_request(options) end # Deletes a gateway. To specify which gateway to delete, use the Amazon # Resource Name (ARN) of the gateway in your request. The operation # deletes the gateway; however, it does not delete the gateway virtual # machine (VM) from your host computer. # # After you delete a gateway, you cannot reactivate it. Completed # snapshots of the gateway volumes are not deleted upon deleting the # gateway, however, pending snapshots will not complete. After you # delete a gateway, your next step is to remove it from your # environment. # # You no longer pay software charges after the gateway is deleted; # however, your existing Amazon EBS snapshots persist and you will # continue to be billed for these snapshots. You can choose to remove # all remaining Amazon EBS snapshots by canceling your Amazon EC2 # subscription.  If you prefer not to cancel your Amazon EC2 # subscription, you can delete your snapshots using the Amazon EC2 # console. For more information, see the [ AWS Storage Gateway Detail # Page][1]. # # # # [1]: http://aws.amazon.com/storagegateway # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::DeleteGatewayOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DeleteGatewayOutput#gateway_arn #gateway_arn} => String # # # @example Example: To delete a gatgeway # # # This operation deletes the gateway, but not the gateway's VM from the host computer. # # resp = client.delete_gateway({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.delete_gateway({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DeleteGateway AWS API Documentation # # @overload delete_gateway(params = {}) # @param [Hash] params ({}) def delete_gateway(params = {}, options = {}) req = build_request(:delete_gateway, params) req.send_request(options) end # Deletes a snapshot of a volume. # # You can take snapshots of your gateway volumes on a scheduled or ad # hoc basis. This API action enables you to delete a snapshot schedule # for a volume. For more information, see [Working with Snapshots][1]. # In the `DeleteSnapshotSchedule` request, you identify the volume by # providing its Amazon Resource Name (ARN). This operation is only # supported in stored and cached volume gateway types. # # <note markdown="1"> To list or delete a snapshot, you must use the Amazon EC2 API. in # *Amazon Elastic Compute Cloud API Reference*. # # </note> # # # # [1]: http://docs.aws.amazon.com/storagegateway/latest/userguide/WorkingWithSnapshots.html # # @option params [required, String] :volume_arn # # @return [Types::DeleteSnapshotScheduleOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DeleteSnapshotScheduleOutput#volume_arn #volume_arn} => String # # # @example Example: To delete a snapshot of a volume # # # This action enables you to delete a snapshot schedule for a volume. # # resp = client.delete_snapshot_schedule({ # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # }) # # resp.to_h outputs the following: # { # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # } # # @example Request syntax with placeholder values # # resp = client.delete_snapshot_schedule({ # volume_arn: "VolumeARN", # required # }) # # @example Response structure # # resp.volume_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DeleteSnapshotSchedule AWS API Documentation # # @overload delete_snapshot_schedule(params = {}) # @param [Hash] params ({}) def delete_snapshot_schedule(params = {}, options = {}) req = build_request(:delete_snapshot_schedule, params) req.send_request(options) end # Deletes the specified virtual tape. This operation is only supported # in the tape gateway type. # # @option params [required, String] :gateway_arn # The unique Amazon Resource Name (ARN) of the gateway that the virtual # tape to delete is associated with. Use the ListGateways operation to # return a list of gateways for your account and region. # # @option params [required, String] :tape_arn # The Amazon Resource Name (ARN) of the virtual tape to delete. # # @return [Types::DeleteTapeOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DeleteTapeOutput#tape_arn #tape_arn} => String # # # @example Example: To delete a virtual tape # # # This example deletes the specified virtual tape. # # resp = client.delete_tape({ # gateway_arn: "arn:aws:storagegateway:us-east-1:204469490176:gateway/sgw-12A3456B", # tape_arn: "arn:aws:storagegateway:us-east-1:204469490176:tape/TEST05A2A0", # }) # # resp.to_h outputs the following: # { # tape_arn: "arn:aws:storagegateway:us-east-1:204469490176:tape/TEST05A2A0", # } # # @example Request syntax with placeholder values # # resp = client.delete_tape({ # gateway_arn: "GatewayARN", # required # tape_arn: "TapeARN", # required # }) # # @example Response structure # # resp.tape_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DeleteTape AWS API Documentation # # @overload delete_tape(params = {}) # @param [Hash] params ({}) def delete_tape(params = {}, options = {}) req = build_request(:delete_tape, params) req.send_request(options) end # Deletes the specified virtual tape from the virtual tape shelf (VTS). # This operation is only supported in the tape gateway type. # # @option params [required, String] :tape_arn # The Amazon Resource Name (ARN) of the virtual tape to delete from the # virtual tape shelf (VTS). # # @return [Types::DeleteTapeArchiveOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DeleteTapeArchiveOutput#tape_arn #tape_arn} => String # # # @example Example: To delete a virtual tape from the shelf (VTS) # # # Deletes the specified virtual tape from the virtual tape shelf (VTS). # # resp = client.delete_tape_archive({ # tape_arn: "arn:aws:storagegateway:us-east-1:204469490176:tape/TEST05A2A0", # }) # # resp.to_h outputs the following: # { # tape_arn: "arn:aws:storagegateway:us-east-1:204469490176:tape/TEST05A2A0", # } # # @example Request syntax with placeholder values # # resp = client.delete_tape_archive({ # tape_arn: "TapeARN", # required # }) # # @example Response structure # # resp.tape_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DeleteTapeArchive AWS API Documentation # # @overload delete_tape_archive(params = {}) # @param [Hash] params ({}) def delete_tape_archive(params = {}, options = {}) req = build_request(:delete_tape_archive, params) req.send_request(options) end # Deletes the specified storage volume that you previously created using # the CreateCachediSCSIVolume or CreateStorediSCSIVolume API. This # operation is only supported in the cached volume and stored volume # types. For stored volume gateways, the local disk that was configured # as the storage volume is not deleted. You can reuse the local disk to # create another storage volume. # # Before you delete a volume, make sure there are no iSCSI connections # to the volume you are deleting. You should also make sure there is no # snapshot in progress. You can use the Amazon Elastic Compute Cloud # (Amazon EC2) API to query snapshots on the volume you are deleting and # check the snapshot status. For more information, go to # [DescribeSnapshots][1] in the *Amazon Elastic Compute Cloud API # Reference*. # # In the request, you must provide the Amazon Resource Name (ARN) of the # storage volume you want to delete. # # # # [1]: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html # # @option params [required, String] :volume_arn # The Amazon Resource Name (ARN) of the volume. Use the ListVolumes # operation to return a list of gateway volumes. # # @return [Types::DeleteVolumeOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DeleteVolumeOutput#volume_arn #volume_arn} => String # # # @example Example: To delete a gateway volume # # # Deletes the specified gateway volume that you previously created using the CreateCachediSCSIVolume or # # CreateStorediSCSIVolume API. # # resp = client.delete_volume({ # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # }) # # resp.to_h outputs the following: # { # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # } # # @example Request syntax with placeholder values # # resp = client.delete_volume({ # volume_arn: "VolumeARN", # required # }) # # @example Response structure # # resp.volume_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DeleteVolume AWS API Documentation # # @overload delete_volume(params = {}) # @param [Hash] params ({}) def delete_volume(params = {}, options = {}) req = build_request(:delete_volume, params) req.send_request(options) end # Returns the bandwidth rate limits of a gateway. By default, these # limits are not set, which means no bandwidth rate limiting is in # effect. # # This operation only returns a value for a bandwidth rate limit only if # the limit is set. If no limits are set for the gateway, then this # operation returns only the gateway ARN in the response body. To # specify which gateway to describe, use the Amazon Resource Name (ARN) # of the gateway in your request. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::DescribeBandwidthRateLimitOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeBandwidthRateLimitOutput#gateway_arn #gateway_arn} => String # * {Types::DescribeBandwidthRateLimitOutput#average_upload_rate_limit_in_bits_per_sec #average_upload_rate_limit_in_bits_per_sec} => Integer # * {Types::DescribeBandwidthRateLimitOutput#average_download_rate_limit_in_bits_per_sec #average_download_rate_limit_in_bits_per_sec} => Integer # # # @example Example: To describe the bandwidth rate limits of a gateway # # # Returns a value for a bandwidth rate limit if set. If not set, then only the gateway ARN is returned. # # resp = client.describe_bandwidth_rate_limit({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # average_download_rate_limit_in_bits_per_sec: 204800, # average_upload_rate_limit_in_bits_per_sec: 102400, # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.describe_bandwidth_rate_limit({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.average_upload_rate_limit_in_bits_per_sec #=> Integer # resp.average_download_rate_limit_in_bits_per_sec #=> Integer # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeBandwidthRateLimit AWS API Documentation # # @overload describe_bandwidth_rate_limit(params = {}) # @param [Hash] params ({}) def describe_bandwidth_rate_limit(params = {}, options = {}) req = build_request(:describe_bandwidth_rate_limit, params) req.send_request(options) end # Returns information about the cache of a gateway. This operation is # only supported in the cached volume, tape and file gateway types. # # The response includes disk IDs that are configured as cache, and it # includes the amount of cache allocated and used. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::DescribeCacheOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeCacheOutput#gateway_arn #gateway_arn} => String # * {Types::DescribeCacheOutput#disk_ids #disk_ids} => Array&lt;String&gt; # * {Types::DescribeCacheOutput#cache_allocated_in_bytes #cache_allocated_in_bytes} => Integer # * {Types::DescribeCacheOutput#cache_used_percentage #cache_used_percentage} => Float # * {Types::DescribeCacheOutput#cache_dirty_percentage #cache_dirty_percentage} => Float # * {Types::DescribeCacheOutput#cache_hit_percentage #cache_hit_percentage} => Float # * {Types::DescribeCacheOutput#cache_miss_percentage #cache_miss_percentage} => Float # # # @example Example: To describe cache information # # # Returns information about the cache of a gateway. # # resp = client.describe_cache({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # cache_allocated_in_bytes: 2199023255552, # cache_dirty_percentage: 0.07, # cache_hit_percentage: 99.68, # cache_miss_percentage: 0.32, # cache_used_percentage: 0.07, # disk_ids: [ # "pci-0000:03:00.0-scsi-0:0:0:0", # "pci-0000:04:00.0-scsi-0:1:0:0", # ], # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.describe_cache({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.disk_ids #=> Array # resp.disk_ids[0] #=> String # resp.cache_allocated_in_bytes #=> Integer # resp.cache_used_percentage #=> Float # resp.cache_dirty_percentage #=> Float # resp.cache_hit_percentage #=> Float # resp.cache_miss_percentage #=> Float # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeCache AWS API Documentation # # @overload describe_cache(params = {}) # @param [Hash] params ({}) def describe_cache(params = {}, options = {}) req = build_request(:describe_cache, params) req.send_request(options) end # Returns a description of the gateway volumes specified in the request. # This operation is only supported in the cached volume gateway types. # # The list of gateway volumes in the request must be from one gateway. # In the response Amazon Storage Gateway returns volume information # sorted by volume Amazon Resource Name (ARN). # # @option params [required, Array<String>] :volume_arns # # @return [Types::DescribeCachediSCSIVolumesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeCachediSCSIVolumesOutput#cached_iscsi_volumes #cached_iscsi_volumes} => Array&lt;Types::CachediSCSIVolume&gt; # # # @example Example: To describe gateway cached iSCSI volumes # # # Returns a description of the gateway cached iSCSI volumes specified in the request. # # resp = client.describe_cached_iscsi_volumes({ # volume_arns: [ # "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # ], # }) # # resp.to_h outputs the following: # { # cached_iscsi_volumes: [ # { # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # volume_id: "vol-1122AABB", # volume_size_in_bytes: 1099511627776, # volume_status: "AVAILABLE", # volume_type: "CACHED iSCSI", # volume_iscsi_attributes: { # chap_enabled: true, # lun_number: 1, # network_interface_id: "10.243.43.207", # network_interface_port: 3260, # target_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume", # }, # }, # ], # } # # @example Request syntax with placeholder values # # resp = client.describe_cached_iscsi_volumes({ # volume_arns: ["VolumeARN"], # required # }) # # @example Response structure # # resp.cached_iscsi_volumes #=> Array # resp.cached_iscsi_volumes[0].volume_arn #=> String # resp.cached_iscsi_volumes[0].volume_id #=> String # resp.cached_iscsi_volumes[0].volume_type #=> String # resp.cached_iscsi_volumes[0].volume_status #=> String # resp.cached_iscsi_volumes[0].volume_size_in_bytes #=> Integer # resp.cached_iscsi_volumes[0].volume_progress #=> Float # resp.cached_iscsi_volumes[0].source_snapshot_id #=> String # resp.cached_iscsi_volumes[0].volume_iscsi_attributes.target_arn #=> String # resp.cached_iscsi_volumes[0].volume_iscsi_attributes.network_interface_id #=> String # resp.cached_iscsi_volumes[0].volume_iscsi_attributes.network_interface_port #=> Integer # resp.cached_iscsi_volumes[0].volume_iscsi_attributes.lun_number #=> Integer # resp.cached_iscsi_volumes[0].volume_iscsi_attributes.chap_enabled #=> Boolean # resp.cached_iscsi_volumes[0].created_date #=> Time # resp.cached_iscsi_volumes[0].volume_used_in_bytes #=> Integer # resp.cached_iscsi_volumes[0].kms_key #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeCachediSCSIVolumes AWS API Documentation # # @overload describe_cached_iscsi_volumes(params = {}) # @param [Hash] params ({}) def describe_cached_iscsi_volumes(params = {}, options = {}) req = build_request(:describe_cached_iscsi_volumes, params) req.send_request(options) end # Returns an array of Challenge-Handshake Authentication Protocol (CHAP) # credentials information for a specified iSCSI target, one for each # target-initiator pair. # # @option params [required, String] :target_arn # The Amazon Resource Name (ARN) of the iSCSI volume target. Use the # DescribeStorediSCSIVolumes operation to return to retrieve the # TargetARN for specified VolumeARN. # # @return [Types::DescribeChapCredentialsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeChapCredentialsOutput#chap_credentials #chap_credentials} => Array&lt;Types::ChapInfo&gt; # # # @example Example: To describe CHAP credetnitals for an iSCSI # # # Returns an array of Challenge-Handshake Authentication Protocol (CHAP) credentials information for a specified iSCSI # # target, one for each target-initiator pair. # # resp = client.describe_chap_credentials({ # target_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume", # }) # # resp.to_h outputs the following: # { # chap_credentials: [ # { # initiator_name: "iqn.1991-05.com.microsoft:computername.domain.example.com", # secret_to_authenticate_initiator: "111111111111", # secret_to_authenticate_target: "222222222222", # target_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume", # }, # ], # } # # @example Request syntax with placeholder values # # resp = client.describe_chap_credentials({ # target_arn: "TargetARN", # required # }) # # @example Response structure # # resp.chap_credentials #=> Array # resp.chap_credentials[0].target_arn #=> String # resp.chap_credentials[0].secret_to_authenticate_initiator #=> String # resp.chap_credentials[0].initiator_name #=> String # resp.chap_credentials[0].secret_to_authenticate_target #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeChapCredentials AWS API Documentation # # @overload describe_chap_credentials(params = {}) # @param [Hash] params ({}) def describe_chap_credentials(params = {}, options = {}) req = build_request(:describe_chap_credentials, params) req.send_request(options) end # Returns metadata about a gateway such as its name, network interfaces, # configured time zone, and the state (whether the gateway is running or # not). To specify which gateway to describe, use the Amazon Resource # Name (ARN) of the gateway in your request. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::DescribeGatewayInformationOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeGatewayInformationOutput#gateway_arn #gateway_arn} => String # * {Types::DescribeGatewayInformationOutput#gateway_id #gateway_id} => String # * {Types::DescribeGatewayInformationOutput#gateway_name #gateway_name} => String # * {Types::DescribeGatewayInformationOutput#gateway_timezone #gateway_timezone} => String # * {Types::DescribeGatewayInformationOutput#gateway_state #gateway_state} => String # * {Types::DescribeGatewayInformationOutput#gateway_network_interfaces #gateway_network_interfaces} => Array&lt;Types::NetworkInterface&gt; # * {Types::DescribeGatewayInformationOutput#gateway_type #gateway_type} => String # * {Types::DescribeGatewayInformationOutput#next_update_availability_date #next_update_availability_date} => String # * {Types::DescribeGatewayInformationOutput#last_software_update #last_software_update} => String # # # @example Example: To describe metadata about the gateway # # # Returns metadata about a gateway such as its name, network interfaces, configured time zone, and the state (whether the # # gateway is running or not). # # resp = client.describe_gateway_information({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # gateway_id: "sgw-AABB1122", # gateway_name: "My_Gateway", # gateway_network_interfaces: [ # { # ipv_4_address: "10.35.69.216", # }, # ], # gateway_state: "STATE_RUNNING", # gateway_timezone: "GMT-8:00", # gateway_type: "STORED", # last_software_update: "2016-01-02T16:00:00", # next_update_availability_date: "2017-01-02T16:00:00", # } # # @example Request syntax with placeholder values # # resp = client.describe_gateway_information({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.gateway_id #=> String # resp.gateway_name #=> String # resp.gateway_timezone #=> String # resp.gateway_state #=> String # resp.gateway_network_interfaces #=> Array # resp.gateway_network_interfaces[0].ipv_4_address #=> String # resp.gateway_network_interfaces[0].mac_address #=> String # resp.gateway_network_interfaces[0].ipv_6_address #=> String # resp.gateway_type #=> String # resp.next_update_availability_date #=> String # resp.last_software_update #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeGatewayInformation AWS API Documentation # # @overload describe_gateway_information(params = {}) # @param [Hash] params ({}) def describe_gateway_information(params = {}, options = {}) req = build_request(:describe_gateway_information, params) req.send_request(options) end # Returns your gateway's weekly maintenance start time including the # day and time of the week. Note that values are in terms of the # gateway's time zone. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::DescribeMaintenanceStartTimeOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeMaintenanceStartTimeOutput#gateway_arn #gateway_arn} => String # * {Types::DescribeMaintenanceStartTimeOutput#hour_of_day #hour_of_day} => Integer # * {Types::DescribeMaintenanceStartTimeOutput#minute_of_hour #minute_of_hour} => Integer # * {Types::DescribeMaintenanceStartTimeOutput#day_of_week #day_of_week} => Integer # * {Types::DescribeMaintenanceStartTimeOutput#timezone #timezone} => String # # # @example Example: To describe gateway's maintenance start time # # # Returns your gateway's weekly maintenance start time including the day and time of the week. # # resp = client.describe_maintenance_start_time({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # day_of_week: 2, # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # hour_of_day: 15, # minute_of_hour: 35, # timezone: "GMT+7:00", # } # # @example Request syntax with placeholder values # # resp = client.describe_maintenance_start_time({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.hour_of_day #=> Integer # resp.minute_of_hour #=> Integer # resp.day_of_week #=> Integer # resp.timezone #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeMaintenanceStartTime AWS API Documentation # # @overload describe_maintenance_start_time(params = {}) # @param [Hash] params ({}) def describe_maintenance_start_time(params = {}, options = {}) req = build_request(:describe_maintenance_start_time, params) req.send_request(options) end # Gets a description for one or more Network File System (NFS) file # shares from a file gateway. This operation is only supported for file # gateways. # # @option params [required, Array<String>] :file_share_arn_list # An array containing the Amazon Resource Name (ARN) of each file share # to be described. # # @return [Types::DescribeNFSFileSharesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeNFSFileSharesOutput#nfs_file_share_info_list #nfs_file_share_info_list} => Array&lt;Types::NFSFileShareInfo&gt; # # @example Request syntax with placeholder values # # resp = client.describe_nfs_file_shares({ # file_share_arn_list: ["FileShareARN"], # required # }) # # @example Response structure # # resp.nfs_file_share_info_list #=> Array # resp.nfs_file_share_info_list[0].nfs_file_share_defaults.file_mode #=> String # resp.nfs_file_share_info_list[0].nfs_file_share_defaults.directory_mode #=> String # resp.nfs_file_share_info_list[0].nfs_file_share_defaults.group_id #=> Integer # resp.nfs_file_share_info_list[0].nfs_file_share_defaults.owner_id #=> Integer # resp.nfs_file_share_info_list[0].file_share_arn #=> String # resp.nfs_file_share_info_list[0].file_share_id #=> String # resp.nfs_file_share_info_list[0].file_share_status #=> String # resp.nfs_file_share_info_list[0].gateway_arn #=> String # resp.nfs_file_share_info_list[0].kms_encrypted #=> Boolean # resp.nfs_file_share_info_list[0].kms_key #=> String # resp.nfs_file_share_info_list[0].path #=> String # resp.nfs_file_share_info_list[0].role #=> String # resp.nfs_file_share_info_list[0].location_arn #=> String # resp.nfs_file_share_info_list[0].default_storage_class #=> String # resp.nfs_file_share_info_list[0].object_acl #=> String, one of "private", "public-read", "public-read-write", "authenticated-read", "bucket-owner-read", "bucket-owner-full-control", "aws-exec-read" # resp.nfs_file_share_info_list[0].client_list #=> Array # resp.nfs_file_share_info_list[0].client_list[0] #=> String # resp.nfs_file_share_info_list[0].squash #=> String # resp.nfs_file_share_info_list[0].read_only #=> Boolean # resp.nfs_file_share_info_list[0].guess_mime_type_enabled #=> Boolean # resp.nfs_file_share_info_list[0].requester_pays #=> Boolean # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeNFSFileShares AWS API Documentation # # @overload describe_nfs_file_shares(params = {}) # @param [Hash] params ({}) def describe_nfs_file_shares(params = {}, options = {}) req = build_request(:describe_nfs_file_shares, params) req.send_request(options) end # Gets a description for one or more Server Message Block (SMB) file # shares from a file gateway. This operation is only supported for file # gateways. # # @option params [required, Array<String>] :file_share_arn_list # An array containing the Amazon Resource Name (ARN) of each file share # to be described. # # @return [Types::DescribeSMBFileSharesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeSMBFileSharesOutput#smb_file_share_info_list #smb_file_share_info_list} => Array&lt;Types::SMBFileShareInfo&gt; # # @example Request syntax with placeholder values # # resp = client.describe_smb_file_shares({ # file_share_arn_list: ["FileShareARN"], # required # }) # # @example Response structure # # resp.smb_file_share_info_list #=> Array # resp.smb_file_share_info_list[0].file_share_arn #=> String # resp.smb_file_share_info_list[0].file_share_id #=> String # resp.smb_file_share_info_list[0].file_share_status #=> String # resp.smb_file_share_info_list[0].gateway_arn #=> String # resp.smb_file_share_info_list[0].kms_encrypted #=> Boolean # resp.smb_file_share_info_list[0].kms_key #=> String # resp.smb_file_share_info_list[0].path #=> String # resp.smb_file_share_info_list[0].role #=> String # resp.smb_file_share_info_list[0].location_arn #=> String # resp.smb_file_share_info_list[0].default_storage_class #=> String # resp.smb_file_share_info_list[0].object_acl #=> String, one of "private", "public-read", "public-read-write", "authenticated-read", "bucket-owner-read", "bucket-owner-full-control", "aws-exec-read" # resp.smb_file_share_info_list[0].read_only #=> Boolean # resp.smb_file_share_info_list[0].guess_mime_type_enabled #=> Boolean # resp.smb_file_share_info_list[0].requester_pays #=> Boolean # resp.smb_file_share_info_list[0].valid_user_list #=> Array # resp.smb_file_share_info_list[0].valid_user_list[0] #=> String # resp.smb_file_share_info_list[0].invalid_user_list #=> Array # resp.smb_file_share_info_list[0].invalid_user_list[0] #=> String # resp.smb_file_share_info_list[0].authentication #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeSMBFileShares AWS API Documentation # # @overload describe_smb_file_shares(params = {}) # @param [Hash] params ({}) def describe_smb_file_shares(params = {}, options = {}) req = build_request(:describe_smb_file_shares, params) req.send_request(options) end # Gets a description of a Server Message Block (SMB) file share settings # from a file gateway. This operation is only supported for file # gateways. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::DescribeSMBSettingsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeSMBSettingsOutput#gateway_arn #gateway_arn} => String # * {Types::DescribeSMBSettingsOutput#domain_name #domain_name} => String # * {Types::DescribeSMBSettingsOutput#smb_guest_password_set #smb_guest_password_set} => Boolean # # @example Request syntax with placeholder values # # resp = client.describe_smb_settings({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.domain_name #=> String # resp.smb_guest_password_set #=> Boolean # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeSMBSettings AWS API Documentation # # @overload describe_smb_settings(params = {}) # @param [Hash] params ({}) def describe_smb_settings(params = {}, options = {}) req = build_request(:describe_smb_settings, params) req.send_request(options) end # Describes the snapshot schedule for the specified gateway volume. The # snapshot schedule information includes intervals at which snapshots # are automatically initiated on the volume. This operation is only # supported in the cached volume and stored volume types. # # @option params [required, String] :volume_arn # The Amazon Resource Name (ARN) of the volume. Use the ListVolumes # operation to return a list of gateway volumes. # # @return [Types::DescribeSnapshotScheduleOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeSnapshotScheduleOutput#volume_arn #volume_arn} => String # * {Types::DescribeSnapshotScheduleOutput#start_at #start_at} => Integer # * {Types::DescribeSnapshotScheduleOutput#recurrence_in_hours #recurrence_in_hours} => Integer # * {Types::DescribeSnapshotScheduleOutput#description #description} => String # * {Types::DescribeSnapshotScheduleOutput#timezone #timezone} => String # # # @example Example: To describe snapshot schedule for gateway volume # # # Describes the snapshot schedule for the specified gateway volume including intervals at which snapshots are # # automatically initiated. # # resp = client.describe_snapshot_schedule({ # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # }) # # resp.to_h outputs the following: # { # description: "sgw-AABB1122:vol-AABB1122:Schedule", # recurrence_in_hours: 24, # start_at: 6, # timezone: "GMT+7:00", # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # } # # @example Request syntax with placeholder values # # resp = client.describe_snapshot_schedule({ # volume_arn: "VolumeARN", # required # }) # # @example Response structure # # resp.volume_arn #=> String # resp.start_at #=> Integer # resp.recurrence_in_hours #=> Integer # resp.description #=> String # resp.timezone #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeSnapshotSchedule AWS API Documentation # # @overload describe_snapshot_schedule(params = {}) # @param [Hash] params ({}) def describe_snapshot_schedule(params = {}, options = {}) req = build_request(:describe_snapshot_schedule, params) req.send_request(options) end # Returns the description of the gateway volumes specified in the # request. The list of gateway volumes in the request must be from one # gateway. In the response Amazon Storage Gateway returns volume # information sorted by volume ARNs. This operation is only supported in # stored volume gateway type. # # @option params [required, Array<String>] :volume_arns # An array of strings where each string represents the Amazon Resource # Name (ARN) of a stored volume. All of the specified stored volumes # must from the same gateway. Use ListVolumes to get volume ARNs for a # gateway. # # @return [Types::DescribeStorediSCSIVolumesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeStorediSCSIVolumesOutput#stored_iscsi_volumes #stored_iscsi_volumes} => Array&lt;Types::StorediSCSIVolume&gt; # # # @example Example: To describe the volumes of a gateway # # # Returns the description of the gateway volumes specified in the request belonging to the same gateway. # # resp = client.describe_stored_iscsi_volumes({ # volume_arns: [ # "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # ], # }) # # resp.to_h outputs the following: # { # stored_iscsi_volumes: [ # { # preserved_existing_data: false, # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # volume_disk_id: "pci-0000:03:00.0-scsi-0:0:0:0", # volume_id: "vol-1122AABB", # volume_progress: 23.7, # volume_size_in_bytes: 1099511627776, # volume_status: "BOOTSTRAPPING", # volume_iscsi_attributes: { # chap_enabled: true, # network_interface_id: "10.243.43.207", # network_interface_port: 3260, # target_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume", # }, # }, # ], # } # # @example Request syntax with placeholder values # # resp = client.describe_stored_iscsi_volumes({ # volume_arns: ["VolumeARN"], # required # }) # # @example Response structure # # resp.stored_iscsi_volumes #=> Array # resp.stored_iscsi_volumes[0].volume_arn #=> String # resp.stored_iscsi_volumes[0].volume_id #=> String # resp.stored_iscsi_volumes[0].volume_type #=> String # resp.stored_iscsi_volumes[0].volume_status #=> String # resp.stored_iscsi_volumes[0].volume_size_in_bytes #=> Integer # resp.stored_iscsi_volumes[0].volume_progress #=> Float # resp.stored_iscsi_volumes[0].volume_disk_id #=> String # resp.stored_iscsi_volumes[0].source_snapshot_id #=> String # resp.stored_iscsi_volumes[0].preserved_existing_data #=> Boolean # resp.stored_iscsi_volumes[0].volume_iscsi_attributes.target_arn #=> String # resp.stored_iscsi_volumes[0].volume_iscsi_attributes.network_interface_id #=> String # resp.stored_iscsi_volumes[0].volume_iscsi_attributes.network_interface_port #=> Integer # resp.stored_iscsi_volumes[0].volume_iscsi_attributes.lun_number #=> Integer # resp.stored_iscsi_volumes[0].volume_iscsi_attributes.chap_enabled #=> Boolean # resp.stored_iscsi_volumes[0].created_date #=> Time # resp.stored_iscsi_volumes[0].volume_used_in_bytes #=> Integer # resp.stored_iscsi_volumes[0].kms_key #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeStorediSCSIVolumes AWS API Documentation # # @overload describe_stored_iscsi_volumes(params = {}) # @param [Hash] params ({}) def describe_stored_iscsi_volumes(params = {}, options = {}) req = build_request(:describe_stored_iscsi_volumes, params) req.send_request(options) end # Returns a description of specified virtual tapes in the virtual tape # shelf (VTS). This operation is only supported in the tape gateway # type. # # If a specific `TapeARN` is not specified, AWS Storage Gateway returns # a description of all virtual tapes found in the VTS associated with # your account. # # @option params [Array<String>] :tape_arns # Specifies one or more unique Amazon Resource Names (ARNs) that # represent the virtual tapes you want to describe. # # @option params [String] :marker # An opaque string that indicates the position at which to begin # describing virtual tapes. # # @option params [Integer] :limit # Specifies that the number of virtual tapes descried be limited to the # specified number. # # @return [Types::DescribeTapeArchivesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeTapeArchivesOutput#tape_archives #tape_archives} => Array&lt;Types::TapeArchive&gt; # * {Types::DescribeTapeArchivesOutput#marker #marker} => String # # # @example Example: To describe virtual tapes in the VTS # # # Returns a description of specified virtual tapes in the virtual tape shelf (VTS). # # resp = client.describe_tape_archives({ # limit: 123, # marker: "1", # tape_arns: [ # "arn:aws:storagegateway:us-east-1:999999999999:tape/AM08A1AD", # "arn:aws:storagegateway:us-east-1:999999999999:tape/AMZN01A2A4", # ], # }) # # resp.to_h outputs the following: # { # marker: "1", # tape_archives: [ # { # completion_time: Time.parse("2016-12-16T13:50Z"), # tape_arn: "arn:aws:storagegateway:us-east-1:999999999:tape/AM08A1AD", # tape_barcode: "AM08A1AD", # tape_size_in_bytes: 107374182400, # tape_status: "ARCHIVED", # }, # { # completion_time: Time.parse("2016-12-16T13:59Z"), # tape_arn: "arn:aws:storagegateway:us-east-1:999999999:tape/AMZN01A2A4", # tape_barcode: "AMZN01A2A4", # tape_size_in_bytes: 429496729600, # tape_status: "ARCHIVED", # }, # ], # } # # @example Request syntax with placeholder values # # resp = client.describe_tape_archives({ # tape_arns: ["TapeARN"], # marker: "Marker", # limit: 1, # }) # # @example Response structure # # resp.tape_archives #=> Array # resp.tape_archives[0].tape_arn #=> String # resp.tape_archives[0].tape_barcode #=> String # resp.tape_archives[0].tape_created_date #=> Time # resp.tape_archives[0].tape_size_in_bytes #=> Integer # resp.tape_archives[0].completion_time #=> Time # resp.tape_archives[0].retrieved_to #=> String # resp.tape_archives[0].tape_status #=> String # resp.tape_archives[0].tape_used_in_bytes #=> Integer # resp.tape_archives[0].kms_key #=> String # resp.marker #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeTapeArchives AWS API Documentation # # @overload describe_tape_archives(params = {}) # @param [Hash] params ({}) def describe_tape_archives(params = {}, options = {}) req = build_request(:describe_tape_archives, params) req.send_request(options) end # Returns a list of virtual tape recovery points that are available for # the specified tape gateway. # # A recovery point is a point-in-time view of a virtual tape at which # all the data on the virtual tape is consistent. If your gateway # crashes, virtual tapes that have recovery points can be recovered to a # new gateway. This operation is only supported in the tape gateway # type. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [String] :marker # An opaque string that indicates the position at which to begin # describing the virtual tape recovery points. # # @option params [Integer] :limit # Specifies that the number of virtual tape recovery points that are # described be limited to the specified number. # # @return [Types::DescribeTapeRecoveryPointsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeTapeRecoveryPointsOutput#gateway_arn #gateway_arn} => String # * {Types::DescribeTapeRecoveryPointsOutput#tape_recovery_point_infos #tape_recovery_point_infos} => Array&lt;Types::TapeRecoveryPointInfo&gt; # * {Types::DescribeTapeRecoveryPointsOutput#marker #marker} => String # # # @example Example: To describe virtual tape recovery points # # # Returns a list of virtual tape recovery points that are available for the specified gateway-VTL. # # resp = client.describe_tape_recovery_points({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # limit: 1, # marker: "1", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # marker: "1", # tape_recovery_point_infos: [ # { # tape_arn: "arn:aws:storagegateway:us-east-1:999999999:tape/AMZN01A2A4", # tape_recovery_point_time: Time.parse("2016-12-16T13:50Z"), # tape_size_in_bytes: 1471550497, # tape_status: "AVAILABLE", # }, # ], # } # # @example Request syntax with placeholder values # # resp = client.describe_tape_recovery_points({ # gateway_arn: "GatewayARN", # required # marker: "Marker", # limit: 1, # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.tape_recovery_point_infos #=> Array # resp.tape_recovery_point_infos[0].tape_arn #=> String # resp.tape_recovery_point_infos[0].tape_recovery_point_time #=> Time # resp.tape_recovery_point_infos[0].tape_size_in_bytes #=> Integer # resp.tape_recovery_point_infos[0].tape_status #=> String # resp.marker #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeTapeRecoveryPoints AWS API Documentation # # @overload describe_tape_recovery_points(params = {}) # @param [Hash] params ({}) def describe_tape_recovery_points(params = {}, options = {}) req = build_request(:describe_tape_recovery_points, params) req.send_request(options) end # Returns a description of the specified Amazon Resource Name (ARN) of # virtual tapes. If a `TapeARN` is not specified, returns a description # of all virtual tapes associated with the specified gateway. This # operation is only supported in the tape gateway type. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [Array<String>] :tape_arns # Specifies one or more unique Amazon Resource Names (ARNs) that # represent the virtual tapes you want to describe. If this parameter is # not specified, Tape gateway returns a description of all virtual tapes # associated with the specified gateway. # # @option params [String] :marker # A marker value, obtained in a previous call to `DescribeTapes`. This # marker indicates which page of results to retrieve. # # If not specified, the first page of results is retrieved. # # @option params [Integer] :limit # Specifies that the number of virtual tapes described be limited to the # specified number. # # <note markdown="1"> Amazon Web Services may impose its own limit, if this field is not # set. # # </note> # # @return [Types::DescribeTapesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeTapesOutput#tapes #tapes} => Array&lt;Types::Tape&gt; # * {Types::DescribeTapesOutput#marker #marker} => String # # # @example Example: To describe virtual tape(s) associated with gateway # # # Returns a description of the specified Amazon Resource Name (ARN) of virtual tapes. If a TapeARN is not specified, # # returns a description of all virtual tapes. # # resp = client.describe_tapes({ # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # limit: 2, # marker: "1", # tape_arns: [ # "arn:aws:storagegateway:us-east-1:999999999999:tape/TEST04A2A1", # "arn:aws:storagegateway:us-east-1:999999999999:tape/TEST05A2A0", # ], # }) # # resp.to_h outputs the following: # { # marker: "1", # tapes: [ # { # tape_arn: "arn:aws:storagegateway:us-east-1:999999999999:tape/TEST04A2A1", # tape_barcode: "TEST04A2A1", # tape_size_in_bytes: 107374182400, # tape_status: "AVAILABLE", # }, # { # tape_arn: "arn:aws:storagegateway:us-east-1:999999999999:tape/TEST05A2A0", # tape_barcode: "TEST05A2A0", # tape_size_in_bytes: 107374182400, # tape_status: "AVAILABLE", # }, # ], # } # # @example Request syntax with placeholder values # # resp = client.describe_tapes({ # gateway_arn: "GatewayARN", # required # tape_arns: ["TapeARN"], # marker: "Marker", # limit: 1, # }) # # @example Response structure # # resp.tapes #=> Array # resp.tapes[0].tape_arn #=> String # resp.tapes[0].tape_barcode #=> String # resp.tapes[0].tape_created_date #=> Time # resp.tapes[0].tape_size_in_bytes #=> Integer # resp.tapes[0].tape_status #=> String # resp.tapes[0].vtl_device #=> String # resp.tapes[0].progress #=> Float # resp.tapes[0].tape_used_in_bytes #=> Integer # resp.tapes[0].kms_key #=> String # resp.marker #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeTapes AWS API Documentation # # @overload describe_tapes(params = {}) # @param [Hash] params ({}) def describe_tapes(params = {}, options = {}) req = build_request(:describe_tapes, params) req.send_request(options) end # Returns information about the upload buffer of a gateway. This # operation is supported for the stored volume, cached volume and tape # gateway types. # # The response includes disk IDs that are configured as upload buffer # space, and it includes the amount of upload buffer space allocated and # used. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::DescribeUploadBufferOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeUploadBufferOutput#gateway_arn #gateway_arn} => String # * {Types::DescribeUploadBufferOutput#disk_ids #disk_ids} => Array&lt;String&gt; # * {Types::DescribeUploadBufferOutput#upload_buffer_used_in_bytes #upload_buffer_used_in_bytes} => Integer # * {Types::DescribeUploadBufferOutput#upload_buffer_allocated_in_bytes #upload_buffer_allocated_in_bytes} => Integer # # # @example Example: To describe upload buffer of gateway # # # Returns information about the upload buffer of a gateway including disk IDs and the amount of upload buffer space # # allocated/used. # # resp = client.describe_upload_buffer({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # disk_ids: [ # "pci-0000:03:00.0-scsi-0:0:0:0", # "pci-0000:04:00.0-scsi-0:1:0:0", # ], # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # upload_buffer_allocated_in_bytes: 0, # upload_buffer_used_in_bytes: 161061273600, # } # # @example Example: To describe upload buffer of a gateway # # # Returns information about the upload buffer of a gateway including disk IDs and the amount of upload buffer space # # allocated and used. # # resp = client.describe_upload_buffer({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # disk_ids: [ # "pci-0000:03:00.0-scsi-0:0:0:0", # "pci-0000:04:00.0-scsi-0:1:0:0", # ], # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # upload_buffer_allocated_in_bytes: 161061273600, # upload_buffer_used_in_bytes: 0, # } # # @example Request syntax with placeholder values # # resp = client.describe_upload_buffer({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.disk_ids #=> Array # resp.disk_ids[0] #=> String # resp.upload_buffer_used_in_bytes #=> Integer # resp.upload_buffer_allocated_in_bytes #=> Integer # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeUploadBuffer AWS API Documentation # # @overload describe_upload_buffer(params = {}) # @param [Hash] params ({}) def describe_upload_buffer(params = {}, options = {}) req = build_request(:describe_upload_buffer, params) req.send_request(options) end # Returns a description of virtual tape library (VTL) devices for the # specified tape gateway. In the response, AWS Storage Gateway returns # VTL device information. # # This operation is only supported in the tape gateway type. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [Array<String>] :vtl_device_arns # An array of strings, where each string represents the Amazon Resource # Name (ARN) of a VTL device. # # <note markdown="1"> All of the specified VTL devices must be from the same gateway. If no # VTL devices are specified, the result will contain all devices on the # specified gateway. # # </note> # # @option params [String] :marker # An opaque string that indicates the position at which to begin # describing the VTL devices. # # @option params [Integer] :limit # Specifies that the number of VTL devices described be limited to the # specified number. # # @return [Types::DescribeVTLDevicesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeVTLDevicesOutput#gateway_arn #gateway_arn} => String # * {Types::DescribeVTLDevicesOutput#vtl_devices #vtl_devices} => Array&lt;Types::VTLDevice&gt; # * {Types::DescribeVTLDevicesOutput#marker #marker} => String # # # @example Example: To describe virtual tape library (VTL) devices of a single gateway # # # Returns a description of virtual tape library (VTL) devices for the specified gateway. # # resp = client.describe_vtl_devices({ # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # limit: 123, # marker: "1", # vtl_device_arns: [ # ], # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # marker: "1", # vtl_devices: [ # { # device_iscsi_attributes: { # chap_enabled: false, # network_interface_id: "10.243.43.207", # network_interface_port: 3260, # target_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:sgw-1fad4876-mediachanger", # }, # vtl_device_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B/device/AMZN_SGW-1FAD4876_MEDIACHANGER_00001", # vtl_device_product_identifier: "L700", # vtl_device_type: "Medium Changer", # vtl_device_vendor: "STK", # }, # { # device_iscsi_attributes: { # chap_enabled: false, # network_interface_id: "10.243.43.209", # network_interface_port: 3260, # target_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:sgw-1fad4876-tapedrive-01", # }, # vtl_device_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B/device/AMZN_SGW-1FAD4876_TAPEDRIVE_00001", # vtl_device_product_identifier: "ULT3580-TD5", # vtl_device_type: "Tape Drive", # vtl_device_vendor: "IBM", # }, # { # device_iscsi_attributes: { # chap_enabled: false, # network_interface_id: "10.243.43.209", # network_interface_port: 3260, # target_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:sgw-1fad4876-tapedrive-02", # }, # vtl_device_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B/device/AMZN_SGW-1FAD4876_TAPEDRIVE_00002", # vtl_device_product_identifier: "ULT3580-TD5", # vtl_device_type: "Tape Drive", # vtl_device_vendor: "IBM", # }, # ], # } # # @example Request syntax with placeholder values # # resp = client.describe_vtl_devices({ # gateway_arn: "GatewayARN", # required # vtl_device_arns: ["VTLDeviceARN"], # marker: "Marker", # limit: 1, # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.vtl_devices #=> Array # resp.vtl_devices[0].vtl_device_arn #=> String # resp.vtl_devices[0].vtl_device_type #=> String # resp.vtl_devices[0].vtl_device_vendor #=> String # resp.vtl_devices[0].vtl_device_product_identifier #=> String # resp.vtl_devices[0].device_iscsi_attributes.target_arn #=> String # resp.vtl_devices[0].device_iscsi_attributes.network_interface_id #=> String # resp.vtl_devices[0].device_iscsi_attributes.network_interface_port #=> Integer # resp.vtl_devices[0].device_iscsi_attributes.chap_enabled #=> Boolean # resp.marker #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeVTLDevices AWS API Documentation # # @overload describe_vtl_devices(params = {}) # @param [Hash] params ({}) def describe_vtl_devices(params = {}, options = {}) req = build_request(:describe_vtl_devices, params) req.send_request(options) end # Returns information about the working storage of a gateway. This # operation is only supported in the stored volumes gateway type. This # operation is deprecated in cached volumes API version (20120630). Use # DescribeUploadBuffer instead. # # <note markdown="1"> Working storage is also referred to as upload buffer. You can also use # the DescribeUploadBuffer operation to add upload buffer to a stored # volume gateway. # # </note> # # The response includes disk IDs that are configured as working storage, # and it includes the amount of working storage allocated and used. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::DescribeWorkingStorageOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeWorkingStorageOutput#gateway_arn #gateway_arn} => String # * {Types::DescribeWorkingStorageOutput#disk_ids #disk_ids} => Array&lt;String&gt; # * {Types::DescribeWorkingStorageOutput#working_storage_used_in_bytes #working_storage_used_in_bytes} => Integer # * {Types::DescribeWorkingStorageOutput#working_storage_allocated_in_bytes #working_storage_allocated_in_bytes} => Integer # # # @example Example: To describe the working storage of a gateway [Depreciated] # # # This operation is supported only for the gateway-stored volume architecture. This operation is deprecated in # # cached-volumes API version (20120630). Use DescribeUploadBuffer instead. # # resp = client.describe_working_storage({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # disk_ids: [ # "pci-0000:03:00.0-scsi-0:0:0:0", # "pci-0000:03:00.0-scsi-0:0:1:0", # ], # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # working_storage_allocated_in_bytes: 2199023255552, # working_storage_used_in_bytes: 789207040, # } # # @example Request syntax with placeholder values # # resp = client.describe_working_storage({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.disk_ids #=> Array # resp.disk_ids[0] #=> String # resp.working_storage_used_in_bytes #=> Integer # resp.working_storage_allocated_in_bytes #=> Integer # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DescribeWorkingStorage AWS API Documentation # # @overload describe_working_storage(params = {}) # @param [Hash] params ({}) def describe_working_storage(params = {}, options = {}) req = build_request(:describe_working_storage, params) req.send_request(options) end # Disables a tape gateway when the gateway is no longer functioning. For # example, if your gateway VM is damaged, you can disable the gateway so # you can recover virtual tapes. # # Use this operation for a tape gateway that is not reachable or not # functioning. This operation is only supported in the tape gateway # type. # # Once a gateway is disabled it cannot be enabled. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::DisableGatewayOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DisableGatewayOutput#gateway_arn #gateway_arn} => String # # # @example Example: To disable a gateway when it is no longer functioning # # # Disables a gateway when the gateway is no longer functioning. Use this operation for a gateway-VTL that is not reachable # # or not functioning. # # resp = client.disable_gateway({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.disable_gateway({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/DisableGateway AWS API Documentation # # @overload disable_gateway(params = {}) # @param [Hash] params ({}) def disable_gateway(params = {}, options = {}) req = build_request(:disable_gateway, params) req.send_request(options) end # Adds a file gateway to an Active Directory domain. This operation is # only supported for file gateways that support the SMB file protocol. # # @option params [required, String] :gateway_arn # The unique Amazon Resource Name (ARN) of the file gateway you want to # add to the Active Directory domain. # # @option params [required, String] :domain_name # The name of the domain that you want the gateway to join. # # @option params [required, String] :user_name # Sets the user name of user who has permission to add the gateway to # the Active Directory domain. # # @option params [required, String] :password # Sets the password of the user who has permission to add the gateway to # the Active Directory domain. # # @return [Types::JoinDomainOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::JoinDomainOutput#gateway_arn #gateway_arn} => String # # @example Request syntax with placeholder values # # resp = client.join_domain({ # gateway_arn: "GatewayARN", # required # domain_name: "DomainName", # required # user_name: "DomainUserName", # required # password: "DomainUserPassword", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/JoinDomain AWS API Documentation # # @overload join_domain(params = {}) # @param [Hash] params ({}) def join_domain(params = {}, options = {}) req = build_request(:join_domain, params) req.send_request(options) end # Gets a list of the file shares for a specific file gateway, or the # list of file shares that belong to the calling user account. This # operation is only supported for file gateways. # # @option params [String] :gateway_arn # The Amazon resource Name (ARN) of the gateway whose file shares you # want to list. If this field is not present, all file shares under your # account are listed. # # @option params [Integer] :limit # The maximum number of file shares to return in the response. The value # must be an integer with a value greater than zero. Optional. # # @option params [String] :marker # Opaque pagination token returned from a previous ListFileShares # operation. If present, `Marker` specifies where to continue the list # from after a previous call to ListFileShares. Optional. # # @return [Types::ListFileSharesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListFileSharesOutput#marker #marker} => String # * {Types::ListFileSharesOutput#next_marker #next_marker} => String # * {Types::ListFileSharesOutput#file_share_info_list #file_share_info_list} => Array&lt;Types::FileShareInfo&gt; # # @example Request syntax with placeholder values # # resp = client.list_file_shares({ # gateway_arn: "GatewayARN", # limit: 1, # marker: "Marker", # }) # # @example Response structure # # resp.marker #=> String # resp.next_marker #=> String # resp.file_share_info_list #=> Array # resp.file_share_info_list[0].file_share_type #=> String, one of "NFS", "SMB" # resp.file_share_info_list[0].file_share_arn #=> String # resp.file_share_info_list[0].file_share_id #=> String # resp.file_share_info_list[0].file_share_status #=> String # resp.file_share_info_list[0].gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/ListFileShares AWS API Documentation # # @overload list_file_shares(params = {}) # @param [Hash] params ({}) def list_file_shares(params = {}, options = {}) req = build_request(:list_file_shares, params) req.send_request(options) end # Lists gateways owned by an AWS account in a region specified in the # request. The returned list is ordered by gateway Amazon Resource Name # (ARN). # # By default, the operation returns a maximum of 100 gateways. This # operation supports pagination that allows you to optionally reduce the # number of gateways returned in a response. # # If you have more gateways than are returned in a response (that is, # the response returns only a truncated list of your gateways), the # response contains a marker that you can specify in your next request # to fetch the next page of gateways. # # @option params [String] :marker # An opaque string that indicates the position at which to begin the # returned list of gateways. # # @option params [Integer] :limit # Specifies that the list of gateways returned be limited to the # specified number of items. # # @return [Types::ListGatewaysOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListGatewaysOutput#gateways #gateways} => Array&lt;Types::GatewayInfo&gt; # * {Types::ListGatewaysOutput#marker #marker} => String # # # @example Example: To lists region specific gateways per AWS account # # # Lists gateways owned by an AWS account in a specified region as requested. Results are sorted by gateway ARN up to a # # maximum of 100 gateways. # # resp = client.list_gateways({ # limit: 2, # marker: "1", # }) # # resp.to_h outputs the following: # { # gateways: [ # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }, # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-23A4567C", # }, # ], # marker: "1", # } # # @example Request syntax with placeholder values # # resp = client.list_gateways({ # marker: "Marker", # limit: 1, # }) # # @example Response structure # # resp.gateways #=> Array # resp.gateways[0].gateway_id #=> String # resp.gateways[0].gateway_arn #=> String # resp.gateways[0].gateway_type #=> String # resp.gateways[0].gateway_operational_state #=> String # resp.gateways[0].gateway_name #=> String # resp.marker #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/ListGateways AWS API Documentation # # @overload list_gateways(params = {}) # @param [Hash] params ({}) def list_gateways(params = {}, options = {}) req = build_request(:list_gateways, params) req.send_request(options) end # Returns a list of the gateway's local disks. To specify which gateway # to describe, you use the Amazon Resource Name (ARN) of the gateway in # the body of the request. # # The request returns a list of all disks, specifying which are # configured as working storage, cache storage, or stored volume or not # configured at all. The response includes a `DiskStatus` field. This # field can have a value of present (the disk is available to use), # missing (the disk is no longer connected to the gateway), or mismatch # (the disk node is occupied by a disk that has incorrect metadata or # the disk content is corrupted). # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::ListLocalDisksOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListLocalDisksOutput#gateway_arn #gateway_arn} => String # * {Types::ListLocalDisksOutput#disks #disks} => Array&lt;Types::Disk&gt; # # # @example Example: To list the gateway's local disks # # # The request returns a list of all disks, specifying which are configured as working storage, cache storage, or stored # # volume or not configured at all. # # resp = client.list_local_disks({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # disks: [ # { # disk_allocation_type: "CACHE_STORAGE", # disk_id: "pci-0000:03:00.0-scsi-0:0:0:0", # disk_node: "SCSI(0:0)", # disk_path: "/dev/sda", # disk_size_in_bytes: 1099511627776, # disk_status: "missing", # }, # { # disk_allocation_resource: "", # disk_allocation_type: "UPLOAD_BUFFER", # disk_id: "pci-0000:03:00.0-scsi-0:0:1:0", # disk_node: "SCSI(0:1)", # disk_path: "/dev/sdb", # disk_size_in_bytes: 1099511627776, # disk_status: "present", # }, # ], # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.list_local_disks({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.disks #=> Array # resp.disks[0].disk_id #=> String # resp.disks[0].disk_path #=> String # resp.disks[0].disk_node #=> String # resp.disks[0].disk_status #=> String # resp.disks[0].disk_size_in_bytes #=> Integer # resp.disks[0].disk_allocation_type #=> String # resp.disks[0].disk_allocation_resource #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/ListLocalDisks AWS API Documentation # # @overload list_local_disks(params = {}) # @param [Hash] params ({}) def list_local_disks(params = {}, options = {}) req = build_request(:list_local_disks, params) req.send_request(options) end # Lists the tags that have been added to the specified resource. This # operation is only supported in the cached volume, stored volume and # tape gateway type. # # @option params [required, String] :resource_arn # The Amazon Resource Name (ARN) of the resource for which you want to # list tags. # # @option params [String] :marker # An opaque string that indicates the position at which to begin # returning the list of tags. # # @option params [Integer] :limit # Specifies that the list of tags returned be limited to the specified # number of items. # # @return [Types::ListTagsForResourceOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListTagsForResourceOutput#resource_arn #resource_arn} => String # * {Types::ListTagsForResourceOutput#marker #marker} => String # * {Types::ListTagsForResourceOutput#tags #tags} => Array&lt;Types::Tag&gt; # # # @example Example: To list tags that have been added to a resource # # # Lists the tags that have been added to the specified resource. # # resp = client.list_tags_for_resource({ # limit: 1, # marker: "1", # resource_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B", # }) # # resp.to_h outputs the following: # { # marker: "1", # resource_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B", # tags: [ # { # key: "Dev Gatgeway Region", # value: "East Coast", # }, # ], # } # # @example Request syntax with placeholder values # # resp = client.list_tags_for_resource({ # resource_arn: "ResourceARN", # required # marker: "Marker", # limit: 1, # }) # # @example Response structure # # resp.resource_arn #=> String # resp.marker #=> String # resp.tags #=> Array # resp.tags[0].key #=> String # resp.tags[0].value #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/ListTagsForResource AWS API Documentation # # @overload list_tags_for_resource(params = {}) # @param [Hash] params ({}) def list_tags_for_resource(params = {}, options = {}) req = build_request(:list_tags_for_resource, params) req.send_request(options) end # Lists virtual tapes in your virtual tape library (VTL) and your # virtual tape shelf (VTS). You specify the tapes to list by specifying # one or more tape Amazon Resource Names (ARNs). If you don't specify a # tape ARN, the operation lists all virtual tapes in both your VTL and # VTS. # # This operation supports pagination. By default, the operation returns # a maximum of up to 100 tapes. You can optionally specify the `Limit` # parameter in the body to limit the number of tapes in the response. If # the number of tapes returned in the response is truncated, the # response includes a `Marker` element that you can use in your # subsequent request to retrieve the next set of tapes. This operation # is only supported in the tape gateway type. # # @option params [Array<String>] :tape_arns # The Amazon Resource Name (ARN) of each of the tapes you want to list. # If you don't specify a tape ARN, the response lists all tapes in both # your VTL and VTS. # # @option params [String] :marker # A string that indicates the position at which to begin the returned # list of tapes. # # @option params [Integer] :limit # An optional number limit for the tapes in the list returned by this # call. # # @return [Types::ListTapesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListTapesOutput#tape_infos #tape_infos} => Array&lt;Types::TapeInfo&gt; # * {Types::ListTapesOutput#marker #marker} => String # # @example Request syntax with placeholder values # # resp = client.list_tapes({ # tape_arns: ["TapeARN"], # marker: "Marker", # limit: 1, # }) # # @example Response structure # # resp.tape_infos #=> Array # resp.tape_infos[0].tape_arn #=> String # resp.tape_infos[0].tape_barcode #=> String # resp.tape_infos[0].tape_size_in_bytes #=> Integer # resp.tape_infos[0].tape_status #=> String # resp.tape_infos[0].gateway_arn #=> String # resp.marker #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/ListTapes AWS API Documentation # # @overload list_tapes(params = {}) # @param [Hash] params ({}) def list_tapes(params = {}, options = {}) req = build_request(:list_tapes, params) req.send_request(options) end # Lists iSCSI initiators that are connected to a volume. You can use # this operation to determine whether a volume is being used or not. # This operation is only supported in the cached volume and stored # volume gateway types. # # @option params [required, String] :volume_arn # The Amazon Resource Name (ARN) of the volume. Use the ListVolumes # operation to return a list of gateway volumes for the gateway. # # @return [Types::ListVolumeInitiatorsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListVolumeInitiatorsOutput#initiators #initiators} => Array&lt;String&gt; # # @example Request syntax with placeholder values # # resp = client.list_volume_initiators({ # volume_arn: "VolumeARN", # required # }) # # @example Response structure # # resp.initiators #=> Array # resp.initiators[0] #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/ListVolumeInitiators AWS API Documentation # # @overload list_volume_initiators(params = {}) # @param [Hash] params ({}) def list_volume_initiators(params = {}, options = {}) req = build_request(:list_volume_initiators, params) req.send_request(options) end # Lists the recovery points for a specified gateway. This operation is # only supported in the cached volume gateway type. # # Each cache volume has one recovery point. A volume recovery point is a # point in time at which all data of the volume is consistent and from # which you can create a snapshot or clone a new cached volume from a # source volume. To create a snapshot from a volume recovery point use # the CreateSnapshotFromVolumeRecoveryPoint operation. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::ListVolumeRecoveryPointsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListVolumeRecoveryPointsOutput#gateway_arn #gateway_arn} => String # * {Types::ListVolumeRecoveryPointsOutput#volume_recovery_point_infos #volume_recovery_point_infos} => Array&lt;Types::VolumeRecoveryPointInfo&gt; # # # @example Example: To list recovery points for a gateway # # # Lists the recovery points for a specified gateway in which all data of the volume is consistent and can be used to # # create a snapshot. # # resp = client.list_volume_recovery_points({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # volume_recovery_point_infos: [ # { # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # volume_recovery_point_time: "2012-09-04T21:08:44.627Z", # volume_size_in_bytes: 536870912000, # }, # ], # } # # @example Request syntax with placeholder values # # resp = client.list_volume_recovery_points({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.volume_recovery_point_infos #=> Array # resp.volume_recovery_point_infos[0].volume_arn #=> String # resp.volume_recovery_point_infos[0].volume_size_in_bytes #=> Integer # resp.volume_recovery_point_infos[0].volume_usage_in_bytes #=> Integer # resp.volume_recovery_point_infos[0].volume_recovery_point_time #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/ListVolumeRecoveryPoints AWS API Documentation # # @overload list_volume_recovery_points(params = {}) # @param [Hash] params ({}) def list_volume_recovery_points(params = {}, options = {}) req = build_request(:list_volume_recovery_points, params) req.send_request(options) end # Lists the iSCSI stored volumes of a gateway. Results are sorted by # volume ARN. The response includes only the volume ARNs. If you want # additional volume information, use the DescribeStorediSCSIVolumes or # the DescribeCachediSCSIVolumes API. # # The operation supports pagination. By default, the operation returns a # maximum of up to 100 volumes. You can optionally specify the `Limit` # field in the body to limit the number of volumes in the response. If # the number of volumes returned in the response is truncated, the # response includes a Marker field. You can use this Marker value in # your subsequent request to retrieve the next set of volumes. This # operation is only supported in the cached volume and stored volume # gateway types. # # @option params [String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [String] :marker # A string that indicates the position at which to begin the returned # list of volumes. Obtain the marker from the response of a previous # List iSCSI Volumes request. # # @option params [Integer] :limit # Specifies that the list of volumes returned be limited to the # specified number of items. # # @return [Types::ListVolumesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListVolumesOutput#gateway_arn #gateway_arn} => String # * {Types::ListVolumesOutput#marker #marker} => String # * {Types::ListVolumesOutput#volume_infos #volume_infos} => Array&lt;Types::VolumeInfo&gt; # # # @example Example: To list the iSCSI stored volumes of a gateway # # # Lists the iSCSI stored volumes of a gateway. Results are sorted by volume ARN up to a maximum of 100 volumes. # # resp = client.list_volumes({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # limit: 2, # marker: "1", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # marker: "1", # volume_infos: [ # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # gateway_id: "sgw-12A3456B", # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # volume_id: "vol-1122AABB", # volume_size_in_bytes: 107374182400, # volume_type: "STORED", # }, # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-13B4567C", # gateway_id: "sgw-gw-13B4567C", # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-13B4567C/volume/vol-3344CCDD", # volume_id: "vol-1122AABB", # volume_size_in_bytes: 107374182400, # volume_type: "STORED", # }, # ], # } # # @example Request syntax with placeholder values # # resp = client.list_volumes({ # gateway_arn: "GatewayARN", # marker: "Marker", # limit: 1, # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.marker #=> String # resp.volume_infos #=> Array # resp.volume_infos[0].volume_arn #=> String # resp.volume_infos[0].volume_id #=> String # resp.volume_infos[0].gateway_arn #=> String # resp.volume_infos[0].gateway_id #=> String # resp.volume_infos[0].volume_type #=> String # resp.volume_infos[0].volume_size_in_bytes #=> Integer # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/ListVolumes AWS API Documentation # # @overload list_volumes(params = {}) # @param [Hash] params ({}) def list_volumes(params = {}, options = {}) req = build_request(:list_volumes, params) req.send_request(options) end # Sends you notification through CloudWatch Events when all files # written to your NFS file share have been uploaded to Amazon S3. # # AWS Storage Gateway can send a notification through Amazon CloudWatch # Events when all files written to your file share up to that point in # time have been uploaded to Amazon S3. These files include files # written to the NFS file share up to the time that you make a request # for notification. When the upload is done, Storage Gateway sends you # notification through an Amazon CloudWatch Event. You can configure # CloudWatch Events to send the notification through event targets such # as Amazon SNS or AWS Lambda function. This operation is only supported # for file gateways. # # For more information, see Getting File Upload Notification in the # Storage Gateway User Guide # (https://docs.aws.amazon.com/storagegateway/latest/userguide/monitoring-file-gateway.html#get-upload-notification). # # @option params [required, String] :file_share_arn # The Amazon Resource Name (ARN) of the file share. # # @return [Types::NotifyWhenUploadedOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::NotifyWhenUploadedOutput#file_share_arn #file_share_arn} => String # * {Types::NotifyWhenUploadedOutput#notification_id #notification_id} => String # # @example Request syntax with placeholder values # # resp = client.notify_when_uploaded({ # file_share_arn: "FileShareARN", # required # }) # # @example Response structure # # resp.file_share_arn #=> String # resp.notification_id #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/NotifyWhenUploaded AWS API Documentation # # @overload notify_when_uploaded(params = {}) # @param [Hash] params ({}) def notify_when_uploaded(params = {}, options = {}) req = build_request(:notify_when_uploaded, params) req.send_request(options) end # Refreshes the cache for the specified file share. This operation finds # objects in the Amazon S3 bucket that were added, removed or replaced # since the gateway last listed the bucket's contents and cached the # results. This operation is only supported in the file gateway type. # You can subscribe to be notified through an Amazon CloudWatch event # when your RefreshCache operation completes. For more information, see # [Getting Notified About File Operations][1]. # # # # [1]: https://docs.aws.amazon.com/storagegateway/latest/userguide/monitoring-file-gateway.html#get-notification # # @option params [required, String] :file_share_arn # The Amazon Resource Name (ARN) of the file share. # # @option params [Array<String>] :folder_list # A comma-separated list of the paths of folders to refresh in the # cache. The default is \[`"/"`\]. The default refreshes objects and # folders at the root of the Amazon S3 bucket. If `Recursive` is set to # "true", the entire S3 bucket that the file share has access to is # refreshed. # # @option params [Boolean] :recursive # A value that specifies whether to recursively refresh folders in the # cache. The refresh includes folders that were in the cache the last # time the gateway listed the folder's contents. If this value set to # "true", each folder that is listed in `FolderList` is recursively # updated. Otherwise, subfolders listed in `FolderList` are not # refreshed. Only objects that are in folders listed directly under # `FolderList` are found and used for the update. The default is # "true". # # @return [Types::RefreshCacheOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::RefreshCacheOutput#file_share_arn #file_share_arn} => String # * {Types::RefreshCacheOutput#notification_id #notification_id} => String # # @example Request syntax with placeholder values # # resp = client.refresh_cache({ # file_share_arn: "FileShareARN", # required # folder_list: ["Folder"], # recursive: false, # }) # # @example Response structure # # resp.file_share_arn #=> String # resp.notification_id #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/RefreshCache AWS API Documentation # # @overload refresh_cache(params = {}) # @param [Hash] params ({}) def refresh_cache(params = {}, options = {}) req = build_request(:refresh_cache, params) req.send_request(options) end # Removes one or more tags from the specified resource. This operation # is only supported in the cached volume, stored volume and tape gateway # types. # # @option params [required, String] :resource_arn # The Amazon Resource Name (ARN) of the resource you want to remove the # tags from. # # @option params [required, Array<String>] :tag_keys # The keys of the tags you want to remove from the specified resource. A # tag is composed of a key/value pair. # # @return [Types::RemoveTagsFromResourceOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::RemoveTagsFromResourceOutput#resource_arn #resource_arn} => String # # # @example Example: To remove tags from a resource # # # Lists the iSCSI stored volumes of a gateway. Removes one or more tags from the specified resource. # # resp = client.remove_tags_from_resource({ # resource_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B", # tag_keys: [ # "Dev Gatgeway Region", # "East Coast", # ], # }) # # resp.to_h outputs the following: # { # resource_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B", # } # # @example Request syntax with placeholder values # # resp = client.remove_tags_from_resource({ # resource_arn: "ResourceARN", # required # tag_keys: ["TagKey"], # required # }) # # @example Response structure # # resp.resource_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/RemoveTagsFromResource AWS API Documentation # # @overload remove_tags_from_resource(params = {}) # @param [Hash] params ({}) def remove_tags_from_resource(params = {}, options = {}) req = build_request(:remove_tags_from_resource, params) req.send_request(options) end # Resets all cache disks that have encountered a error and makes the # disks available for reconfiguration as cache storage. If your cache # disk encounters a error, the gateway prevents read and write # operations on virtual tapes in the gateway. For example, an error can # occur when a disk is corrupted or removed from the gateway. When a # cache is reset, the gateway loses its cache storage. At this point you # can reconfigure the disks as cache disks. This operation is only # supported in the cached volume and tape types. # # If the cache disk you are resetting contains data that has not been # uploaded to Amazon S3 yet, that data can be lost. After you reset # cache disks, there will be no configured cache disks left in the # gateway, so you must configure at least one new cache disk for your # gateway to function properly. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::ResetCacheOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ResetCacheOutput#gateway_arn #gateway_arn} => String # # # @example Example: To reset cache disks in error status # # # Resets all cache disks that have encountered a error and makes the disks available for reconfiguration as cache storage. # # resp = client.reset_cache({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-13B4567C", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-13B4567C", # } # # @example Request syntax with placeholder values # # resp = client.reset_cache({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/ResetCache AWS API Documentation # # @overload reset_cache(params = {}) # @param [Hash] params ({}) def reset_cache(params = {}, options = {}) req = build_request(:reset_cache, params) req.send_request(options) end # Retrieves an archived virtual tape from the virtual tape shelf (VTS) # to a tape gateway. Virtual tapes archived in the VTS are not # associated with any gateway. However after a tape is retrieved, it is # associated with a gateway, even though it is also listed in the VTS, # that is, archive. This operation is only supported in the tape gateway # type. # # Once a tape is successfully retrieved to a gateway, it cannot be # retrieved again to another gateway. You must archive the tape again # before you can retrieve it to another gateway. This operation is only # supported in the tape gateway type. # # @option params [required, String] :tape_arn # The Amazon Resource Name (ARN) of the virtual tape you want to # retrieve from the virtual tape shelf (VTS). # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway you want to retrieve the # virtual tape to. Use the ListGateways operation to return a list of # gateways for your account and region. # # You retrieve archived virtual tapes to only one gateway and the # gateway must be a tape gateway. # # @return [Types::RetrieveTapeArchiveOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::RetrieveTapeArchiveOutput#tape_arn #tape_arn} => String # # # @example Example: To retrieve an archived tape from the VTS # # # Retrieves an archived virtual tape from the virtual tape shelf (VTS) to a gateway-VTL. Virtual tapes archived in the VTS # # are not associated with any gateway. # # resp = client.retrieve_tape_archive({ # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # tape_arn: "arn:aws:storagegateway:us-east-1:999999999999:tape/TEST0AA2AF", # }) # # resp.to_h outputs the following: # { # tape_arn: "arn:aws:storagegateway:us-east-1:999999999999:tape/TEST0AA2AF", # } # # @example Request syntax with placeholder values # # resp = client.retrieve_tape_archive({ # tape_arn: "TapeARN", # required # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.tape_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/RetrieveTapeArchive AWS API Documentation # # @overload retrieve_tape_archive(params = {}) # @param [Hash] params ({}) def retrieve_tape_archive(params = {}, options = {}) req = build_request(:retrieve_tape_archive, params) req.send_request(options) end # Retrieves the recovery point for the specified virtual tape. This # operation is only supported in the tape gateway type. # # A recovery point is a point in time view of a virtual tape at which # all the data on the tape is consistent. If your gateway crashes, # virtual tapes that have recovery points can be recovered to a new # gateway. # # <note markdown="1"> The virtual tape can be retrieved to only one gateway. The retrieved # tape is read-only. The virtual tape can be retrieved to only a tape # gateway. There is no charge for retrieving recovery points. # # </note> # # @option params [required, String] :tape_arn # The Amazon Resource Name (ARN) of the virtual tape for which you want # to retrieve the recovery point. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::RetrieveTapeRecoveryPointOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::RetrieveTapeRecoveryPointOutput#tape_arn #tape_arn} => String # # # @example Example: To retrieve the recovery point of a virtual tape # # # Retrieves the recovery point for the specified virtual tape. # # resp = client.retrieve_tape_recovery_point({ # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # tape_arn: "arn:aws:storagegateway:us-east-1:999999999999:tape/TEST0AA2AF", # }) # # resp.to_h outputs the following: # { # tape_arn: "arn:aws:storagegateway:us-east-1:999999999999:tape/TEST0AA2AF", # } # # @example Request syntax with placeholder values # # resp = client.retrieve_tape_recovery_point({ # tape_arn: "TapeARN", # required # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.tape_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/RetrieveTapeRecoveryPoint AWS API Documentation # # @overload retrieve_tape_recovery_point(params = {}) # @param [Hash] params ({}) def retrieve_tape_recovery_point(params = {}, options = {}) req = build_request(:retrieve_tape_recovery_point, params) req.send_request(options) end # Sets the password for your VM local console. When you log in to the # local console for the first time, you log in to the VM with the # default credentials. We recommend that you set a new password. You # don't need to know the default password to set a new password. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [required, String] :local_console_password # The password you want to set for your VM local console. # # @return [Types::SetLocalConsolePasswordOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::SetLocalConsolePasswordOutput#gateway_arn #gateway_arn} => String # # # @example Example: To set a password for your VM # # # Sets the password for your VM local console. # # resp = client.set_local_console_password({ # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # local_console_password: "PassWordMustBeAtLeast6Chars.", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.set_local_console_password({ # gateway_arn: "GatewayARN", # required # local_console_password: "LocalConsolePassword", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/SetLocalConsolePassword AWS API Documentation # # @overload set_local_console_password(params = {}) # @param [Hash] params ({}) def set_local_console_password(params = {}, options = {}) req = build_request(:set_local_console_password, params) req.send_request(options) end # Sets the password for the guest user `smbguest`. The `smbguest` user # is the user when the authentication method for the file share is set # to `GuestAccess`. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the file gateway the SMB file share # is associated with. # # @option params [required, String] :password # The password that you want to set for your SMB Server. # # @return [Types::SetSMBGuestPasswordOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::SetSMBGuestPasswordOutput#gateway_arn #gateway_arn} => String # # @example Request syntax with placeholder values # # resp = client.set_smb_guest_password({ # gateway_arn: "GatewayARN", # required # password: "SMBGuestPassword", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/SetSMBGuestPassword AWS API Documentation # # @overload set_smb_guest_password(params = {}) # @param [Hash] params ({}) def set_smb_guest_password(params = {}, options = {}) req = build_request(:set_smb_guest_password, params) req.send_request(options) end # Shuts down a gateway. To specify which gateway to shut down, use the # Amazon Resource Name (ARN) of the gateway in the body of your request. # # The operation shuts down the gateway service component running in the # gateway's virtual machine (VM) and not the host VM. # # <note markdown="1"> If you want to shut down the VM, it is recommended that you first shut # down the gateway component in the VM to avoid unpredictable # conditions. # # </note> # # After the gateway is shutdown, you cannot call any other API except # StartGateway, DescribeGatewayInformation, and ListGateways. For more # information, see ActivateGateway. Your applications cannot read from # or write to the gateway's storage volumes, and there are no snapshots # taken. # # <note markdown="1"> When you make a shutdown request, you will get a `200 OK` success # response immediately. However, it might take some time for the gateway # to shut down. You can call the DescribeGatewayInformation API to check # the status. For more information, see ActivateGateway. # # </note> # # If do not intend to use the gateway again, you must delete the gateway # (using DeleteGateway) to no longer pay software charges associated # with the gateway. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::ShutdownGatewayOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ShutdownGatewayOutput#gateway_arn #gateway_arn} => String # # # @example Example: To shut down a gateway service # # # This operation shuts down the gateway service component running in the storage gateway's virtual machine (VM) and not # # the VM. # # resp = client.shutdown_gateway({ # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.shutdown_gateway({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/ShutdownGateway AWS API Documentation # # @overload shutdown_gateway(params = {}) # @param [Hash] params ({}) def shutdown_gateway(params = {}, options = {}) req = build_request(:shutdown_gateway, params) req.send_request(options) end # Starts a gateway that you previously shut down (see ShutdownGateway). # After the gateway starts, you can then make other API calls, your # applications can read from or write to the gateway's storage volumes # and you will be able to take snapshot backups. # # <note markdown="1"> When you make a request, you will get a 200 OK success response # immediately. However, it might take some time for the gateway to be # ready. You should call DescribeGatewayInformation and check the status # before making any additional API calls. For more information, see # ActivateGateway. # # </note> # # To specify which gateway to start, use the Amazon Resource Name (ARN) # of the gateway in your request. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::StartGatewayOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::StartGatewayOutput#gateway_arn #gateway_arn} => String # # # @example Example: To start a gateway service # # # Starts a gateway service that was previously shut down. # # resp = client.start_gateway({ # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.start_gateway({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/StartGateway AWS API Documentation # # @overload start_gateway(params = {}) # @param [Hash] params ({}) def start_gateway(params = {}, options = {}) req = build_request(:start_gateway, params) req.send_request(options) end # Updates the bandwidth rate limits of a gateway. You can update both # the upload and download bandwidth rate limit or specify only one of # the two. If you don't set a bandwidth rate limit, the existing rate # limit remains. # # By default, a gateway's bandwidth rate limits are not set. If you # don't set any limit, the gateway does not have any limitations on its # bandwidth usage and could potentially use the maximum available # bandwidth. # # To specify which gateway to update, use the Amazon Resource Name (ARN) # of the gateway in your request. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [Integer] :average_upload_rate_limit_in_bits_per_sec # The average upload bandwidth rate limit in bits per second. # # @option params [Integer] :average_download_rate_limit_in_bits_per_sec # The average download bandwidth rate limit in bits per second. # # @return [Types::UpdateBandwidthRateLimitOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateBandwidthRateLimitOutput#gateway_arn #gateway_arn} => String # # # @example Example: To update the bandwidth rate limits of a gateway # # # Updates the bandwidth rate limits of a gateway. Both the upload and download bandwidth rate limit can be set, or either # # one of the two. If a new limit is not set, the existing rate limit remains. # # resp = client.update_bandwidth_rate_limit({ # average_download_rate_limit_in_bits_per_sec: 102400, # average_upload_rate_limit_in_bits_per_sec: 51200, # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.update_bandwidth_rate_limit({ # gateway_arn: "GatewayARN", # required # average_upload_rate_limit_in_bits_per_sec: 1, # average_download_rate_limit_in_bits_per_sec: 1, # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/UpdateBandwidthRateLimit AWS API Documentation # # @overload update_bandwidth_rate_limit(params = {}) # @param [Hash] params ({}) def update_bandwidth_rate_limit(params = {}, options = {}) req = build_request(:update_bandwidth_rate_limit, params) req.send_request(options) end # Updates the Challenge-Handshake Authentication Protocol (CHAP) # credentials for a specified iSCSI target. By default, a gateway does # not have CHAP enabled; however, for added security, you might use it. # # When you update CHAP credentials, all existing connections on the # target are closed and initiators must reconnect with the new # credentials. # # @option params [required, String] :target_arn # The Amazon Resource Name (ARN) of the iSCSI volume target. Use the # DescribeStorediSCSIVolumes operation to return the TargetARN for # specified VolumeARN. # # @option params [required, String] :secret_to_authenticate_initiator # The secret key that the initiator (for example, the Windows client) # must provide to participate in mutual CHAP with the target. # # <note markdown="1"> The secret key must be between 12 and 16 bytes when encoded in UTF-8. # # </note> # # @option params [required, String] :initiator_name # The iSCSI initiator that connects to the target. # # @option params [String] :secret_to_authenticate_target # The secret key that the target must provide to participate in mutual # CHAP with the initiator (e.g. Windows client). # # Byte constraints: Minimum bytes of 12. Maximum bytes of 16. # # <note markdown="1"> The secret key must be between 12 and 16 bytes when encoded in UTF-8. # # </note> # # @return [Types::UpdateChapCredentialsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateChapCredentialsOutput#target_arn #target_arn} => String # * {Types::UpdateChapCredentialsOutput#initiator_name #initiator_name} => String # # # @example Example: To update CHAP credentials for an iSCSI target # # # Updates the Challenge-Handshake Authentication Protocol (CHAP) credentials for a specified iSCSI target. # # resp = client.update_chap_credentials({ # initiator_name: "iqn.1991-05.com.microsoft:computername.domain.example.com", # secret_to_authenticate_initiator: "111111111111", # secret_to_authenticate_target: "222222222222", # target_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume", # }) # # resp.to_h outputs the following: # { # initiator_name: "iqn.1991-05.com.microsoft:computername.domain.example.com", # target_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume", # } # # @example Request syntax with placeholder values # # resp = client.update_chap_credentials({ # target_arn: "TargetARN", # required # secret_to_authenticate_initiator: "ChapSecret", # required # initiator_name: "IqnName", # required # secret_to_authenticate_target: "ChapSecret", # }) # # @example Response structure # # resp.target_arn #=> String # resp.initiator_name #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/UpdateChapCredentials AWS API Documentation # # @overload update_chap_credentials(params = {}) # @param [Hash] params ({}) def update_chap_credentials(params = {}, options = {}) req = build_request(:update_chap_credentials, params) req.send_request(options) end # Updates a gateway's metadata, which includes the gateway's name and # time zone. To specify which gateway to update, use the Amazon Resource # Name (ARN) of the gateway in your request. # # <note markdown="1"> For Gateways activated after September 2, 2015, the gateway's ARN # contains the gateway ID rather than the gateway name. However, # changing the name of the gateway has no effect on the gateway's ARN. # # </note> # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [String] :gateway_name # The name you configured for your gateway. # # @option params [String] :gateway_timezone # # @return [Types::UpdateGatewayInformationOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateGatewayInformationOutput#gateway_arn #gateway_arn} => String # * {Types::UpdateGatewayInformationOutput#gateway_name #gateway_name} => String # # # @example Example: To update a gateway's metadata # # # Updates a gateway's metadata, which includes the gateway's name and time zone. # # resp = client.update_gateway_information({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # gateway_name: "MyGateway2", # gateway_timezone: "GMT-12:00", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # gateway_name: "", # } # # @example Request syntax with placeholder values # # resp = client.update_gateway_information({ # gateway_arn: "GatewayARN", # required # gateway_name: "GatewayName", # gateway_timezone: "GatewayTimezone", # }) # # @example Response structure # # resp.gateway_arn #=> String # resp.gateway_name #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/UpdateGatewayInformation AWS API Documentation # # @overload update_gateway_information(params = {}) # @param [Hash] params ({}) def update_gateway_information(params = {}, options = {}) req = build_request(:update_gateway_information, params) req.send_request(options) end # Updates the gateway virtual machine (VM) software. The request # immediately triggers the software update. # # <note markdown="1"> When you make this request, you get a `200 OK` success response # immediately. However, it might take some time for the update to # complete. You can call DescribeGatewayInformation to verify the # gateway is in the `STATE_RUNNING` state. # # </note> # # A software update forces a system restart of your gateway. You can # minimize the chance of any disruption to your applications by # increasing your iSCSI Initiators' timeouts. For more information # about increasing iSCSI Initiator timeouts for Windows and Linux, see # [Customizing Your Windows iSCSI Settings][1] and [Customizing Your # Linux iSCSI Settings][2], respectively. # # # # [1]: http://docs.aws.amazon.com/storagegateway/latest/userguide/ConfiguringiSCSIClientInitiatorWindowsClient.html#CustomizeWindowsiSCSISettings # [2]: http://docs.aws.amazon.com/storagegateway/latest/userguide/ConfiguringiSCSIClientInitiatorRedHatClient.html#CustomizeLinuxiSCSISettings # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @return [Types::UpdateGatewaySoftwareNowOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateGatewaySoftwareNowOutput#gateway_arn #gateway_arn} => String # # # @example Example: To update a gateway's VM software # # # Updates the gateway virtual machine (VM) software. The request immediately triggers the software update. # # resp = client.update_gateway_software_now({ # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.update_gateway_software_now({ # gateway_arn: "GatewayARN", # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/UpdateGatewaySoftwareNow AWS API Documentation # # @overload update_gateway_software_now(params = {}) # @param [Hash] params ({}) def update_gateway_software_now(params = {}, options = {}) req = build_request(:update_gateway_software_now, params) req.send_request(options) end # Updates a gateway's weekly maintenance start time information, # including day and time of the week. The maintenance time is the time # in your gateway's time zone. # # @option params [required, String] :gateway_arn # The Amazon Resource Name (ARN) of the gateway. Use the ListGateways # operation to return a list of gateways for your account and region. # # @option params [required, Integer] :hour_of_day # The hour component of the maintenance start time represented as *hh*, # where *hh* is the hour (00 to 23). The hour of the day is in the time # zone of the gateway. # # @option params [required, Integer] :minute_of_hour # The minute component of the maintenance start time represented as # *mm*, where *mm* is the minute (00 to 59). The minute of the hour is # in the time zone of the gateway. # # @option params [required, Integer] :day_of_week # The maintenance start time day of the week represented as an ordinal # number from 0 to 6, where 0 represents Sunday and 6 Saturday. # # @return [Types::UpdateMaintenanceStartTimeOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateMaintenanceStartTimeOutput#gateway_arn #gateway_arn} => String # # # @example Example: To update a gateway's maintenance start time # # # Updates a gateway's weekly maintenance start time information, including day and time of the week. The maintenance time # # is in your gateway's time zone. # # resp = client.update_maintenance_start_time({ # day_of_week: 2, # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # hour_of_day: 0, # minute_of_hour: 30, # }) # # resp.to_h outputs the following: # { # gateway_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B", # } # # @example Request syntax with placeholder values # # resp = client.update_maintenance_start_time({ # gateway_arn: "GatewayARN", # required # hour_of_day: 1, # required # minute_of_hour: 1, # required # day_of_week: 1, # required # }) # # @example Response structure # # resp.gateway_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/UpdateMaintenanceStartTime AWS API Documentation # # @overload update_maintenance_start_time(params = {}) # @param [Hash] params ({}) def update_maintenance_start_time(params = {}, options = {}) req = build_request(:update_maintenance_start_time, params) req.send_request(options) end # Updates a Network File System (NFS) file share. This operation is only # supported in the file gateway type. # # <note markdown="1"> To leave a file share field unchanged, set the corresponding input # field to null. # # </note> # # Updates the following file share setting: # # * Default storage class for your S3 bucket # # * Metadata defaults for your S3 bucket # # * Allowed NFS clients for your file share # # * Squash settings # # * Write status of your file share # # <note markdown="1"> To leave a file share field unchanged, set the corresponding input # field to null. This operation is only supported in file gateways. # # </note> # # @option params [required, String] :file_share_arn # The Amazon Resource Name (ARN) of the file share to be updated. # # @option params [Boolean] :kms_encrypted # True to use Amazon S3 server side encryption with your own AWS KMS # key, or false to use a key managed by Amazon S3. Optional. # # @option params [String] :kms_key # The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 # server side encryption. This value can only be set when KMSEncrypted # is true. Optional. # # @option params [Types::NFSFileShareDefaults] :nfs_file_share_defaults # The default values for the file share. Optional. # # @option params [String] :default_storage_class # The default storage class for objects put into an Amazon S3 bucket by # the file gateway. Possible values are `S3_STANDARD`, `S3_STANDARD_IA`, # or `S3_ONEZONE_IA`. If this field is not populated, the default value # `S3_STANDARD` is used. Optional. # # @option params [String] :object_acl # A value that sets the access control list permission for objects in # the S3 bucket that a file gateway puts objects into. The default value # is "private". # # @option params [Array<String>] :client_list # The list of clients that are allowed to access the file gateway. The # list must contain either valid IP addresses or valid CIDR blocks. # # @option params [String] :squash # The user mapped to anonymous user. Valid options are the following: # # * `RootSquash` - Only root is mapped to anonymous user. # # * `NoSquash` - No one is mapped to anonymous user # # * `AllSquash` - Everyone is mapped to anonymous user. # # @option params [Boolean] :read_only # A value that sets the write status of a file share. This value is true # if the write status is read-only, and otherwise false. # # @option params [Boolean] :guess_mime_type_enabled # A value that enables guessing of the MIME type for uploaded objects # based on file extensions. Set this value to true to enable MIME type # guessing, and otherwise to false. The default value is true. # # @option params [Boolean] :requester_pays # A value that sets the access control list permission for objects in # the Amazon S3 bucket that a file gateway puts objects into. The # default value is `private`. # # @return [Types::UpdateNFSFileShareOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateNFSFileShareOutput#file_share_arn #file_share_arn} => String # # @example Request syntax with placeholder values # # resp = client.update_nfs_file_share({ # file_share_arn: "FileShareARN", # required # kms_encrypted: false, # kms_key: "KMSKey", # nfs_file_share_defaults: { # file_mode: "PermissionMode", # directory_mode: "PermissionMode", # group_id: 1, # owner_id: 1, # }, # default_storage_class: "StorageClass", # object_acl: "private", # accepts private, public-read, public-read-write, authenticated-read, bucket-owner-read, bucket-owner-full-control, aws-exec-read # client_list: ["IPV4AddressCIDR"], # squash: "Squash", # read_only: false, # guess_mime_type_enabled: false, # requester_pays: false, # }) # # @example Response structure # # resp.file_share_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/UpdateNFSFileShare AWS API Documentation # # @overload update_nfs_file_share(params = {}) # @param [Hash] params ({}) def update_nfs_file_share(params = {}, options = {}) req = build_request(:update_nfs_file_share, params) req.send_request(options) end # Updates a Server Message Block (SMB) file share. # # <note markdown="1"> To leave a file share field unchanged, set the corresponding input # field to null. This operation is only supported for file gateways. # # </note> # # File gateways require AWS Security Token Service (AWS STS) to be # activated to enable you to create a file share. Make sure that AWS STS # is activated in the AWS Region you are creating your file gateway in. # If AWS STS is not activated in this AWS Region, activate it. For # information about how to activate AWS STS, see [Activating and # Deactivating AWS STS in an AWS Region][1] in the *AWS Identity and # Access Management User Guide.* # # File gateways don't support creating hard or symbolic links on a # file # share. # # # # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html # # @option params [required, String] :file_share_arn # The Amazon Resource Name (ARN) of the SMB file share that you want to # update. # # @option params [Boolean] :kms_encrypted # True to use Amazon S3 server side encryption with your own AWS KMS # key, or false to use a key managed by Amazon S3. Optional. # # @option params [String] :kms_key # The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 # server side encryption. This value can only be set when KMSEncrypted # is true. Optional. # # @option params [String] :default_storage_class # The default storage class for objects put into an Amazon S3 bucket by # the file gateway. Possible values are `S3_STANDARD`, `S3_STANDARD_IA`, # or `S3_ONEZONE_IA`. If this field is not populated, the default value # `S3_STANDARD` is used. Optional. # # @option params [String] :object_acl # A value that sets the access control list permission for objects in # the S3 bucket that a file gateway puts objects into. The default value # is "private". # # @option params [Boolean] :read_only # A value that sets the write status of a file share. This value is true # if the write status is read-only, and otherwise false. # # @option params [Boolean] :guess_mime_type_enabled # A value that enables guessing of the MIME type for uploaded objects # based on file extensions. Set this value to true to enable MIME type # guessing, and otherwise to false. The default value is true. # # @option params [Boolean] :requester_pays # A value that sets the access control list permission for objects in # the Amazon S3 bucket that a file gateway puts objects into. The # default value is `private`. # # @option params [Array<String>] :valid_user_list # A list of users or groups in the Active Directory that are allowed to # access the file share. A group must be prefixed with the @ character. # For example `@group1`. Can only be set if Authentication is set to # `ActiveDirectory`. # # @option params [Array<String>] :invalid_user_list # A list of users or groups in the Active Directory that are not allowed # to access the file share. A group must be prefixed with the @ # character. For example `@group1`. Can only be set if Authentication is # set to `ActiveDirectory`. # # @return [Types::UpdateSMBFileShareOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateSMBFileShareOutput#file_share_arn #file_share_arn} => String # # @example Request syntax with placeholder values # # resp = client.update_smb_file_share({ # file_share_arn: "FileShareARN", # required # kms_encrypted: false, # kms_key: "KMSKey", # default_storage_class: "StorageClass", # object_acl: "private", # accepts private, public-read, public-read-write, authenticated-read, bucket-owner-read, bucket-owner-full-control, aws-exec-read # read_only: false, # guess_mime_type_enabled: false, # requester_pays: false, # valid_user_list: ["FileShareUser"], # invalid_user_list: ["FileShareUser"], # }) # # @example Response structure # # resp.file_share_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/UpdateSMBFileShare AWS API Documentation # # @overload update_smb_file_share(params = {}) # @param [Hash] params ({}) def update_smb_file_share(params = {}, options = {}) req = build_request(:update_smb_file_share, params) req.send_request(options) end # Updates a snapshot schedule configured for a gateway volume. This # operation is only supported in the cached volume and stored volume # gateway types. # # The default snapshot schedule for volume is once every 24 hours, # starting at the creation time of the volume. You can use this API to # change the snapshot schedule configured for the volume. # # In the request you must identify the gateway volume whose snapshot # schedule you want to update, and the schedule information, including # when you want the snapshot to begin on a day and the frequency (in # hours) of snapshots. # # @option params [required, String] :volume_arn # The Amazon Resource Name (ARN) of the volume. Use the ListVolumes # operation to return a list of gateway volumes. # # @option params [required, Integer] :start_at # The hour of the day at which the snapshot schedule begins represented # as *hh*, where *hh* is the hour (0 to 23). The hour of the day is in # the time zone of the gateway. # # @option params [required, Integer] :recurrence_in_hours # Frequency of snapshots. Specify the number of hours between snapshots. # # @option params [String] :description # Optional description of the snapshot that overwrites the existing # description. # # @return [Types::UpdateSnapshotScheduleOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateSnapshotScheduleOutput#volume_arn #volume_arn} => String # # # @example Example: To update a volume snapshot schedule # # # Updates a snapshot schedule configured for a gateway volume. # # resp = client.update_snapshot_schedule({ # description: "Hourly snapshot", # recurrence_in_hours: 1, # start_at: 0, # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # }) # # resp.to_h outputs the following: # { # volume_arn: "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", # } # # @example Request syntax with placeholder values # # resp = client.update_snapshot_schedule({ # volume_arn: "VolumeARN", # required # start_at: 1, # required # recurrence_in_hours: 1, # required # description: "Description", # }) # # @example Response structure # # resp.volume_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/UpdateSnapshotSchedule AWS API Documentation # # @overload update_snapshot_schedule(params = {}) # @param [Hash] params ({}) def update_snapshot_schedule(params = {}, options = {}) req = build_request(:update_snapshot_schedule, params) req.send_request(options) end # Updates the type of medium changer in a tape gateway. When you # activate a tape gateway, you select a medium changer type for the tape # gateway. This operation enables you to select a different type of # medium changer after a tape gateway is activated. This operation is # only supported in the tape gateway type. # # @option params [required, String] :vtl_device_arn # The Amazon Resource Name (ARN) of the medium changer you want to # select. # # @option params [required, String] :device_type # The type of medium changer you want to select. # # Valid Values: "STK-L700", "AWS-Gateway-VTL" # # @return [Types::UpdateVTLDeviceTypeOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateVTLDeviceTypeOutput#vtl_device_arn #vtl_device_arn} => String # # # @example Example: To update a VTL device type # # # Updates the type of medium changer in a gateway-VTL after a gateway-VTL is activated. # # resp = client.update_vtl_device_type({ # device_type: "Medium Changer", # vtl_device_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B/device/AMZN_SGW-1FAD4876_MEDIACHANGER_00001", # }) # # resp.to_h outputs the following: # { # vtl_device_arn: "arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B/device/AMZN_SGW-1FAD4876_MEDIACHANGER_00001", # } # # @example Request syntax with placeholder values # # resp = client.update_vtl_device_type({ # vtl_device_arn: "VTLDeviceARN", # required # device_type: "DeviceType", # required # }) # # @example Response structure # # resp.vtl_device_arn #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/UpdateVTLDeviceType AWS API Documentation # # @overload update_vtl_device_type(params = {}) # @param [Hash] params ({}) def update_vtl_device_type(params = {}, options = {}) req = build_request(:update_vtl_device_type, params) req.send_request(options) end # @!endgroup # @param params ({}) # @api private def build_request(operation_name, params = {}) handlers = @handlers.for(operation_name) context = Seahorse::Client::RequestContext.new( operation_name: operation_name, operation: config.api.operation(operation_name), client: self, params: params, config: config) context[:gem_name] = 'aws-sdk-storagegateway' context[:gem_version] = '1.12.0' Seahorse::Client::Request.new(handlers, context) end # @api private # @deprecated def waiter_names [] end class << self # @api private attr_reader :identifier # @api private def errors_module Errors end end end end
42.658407
205
0.662398
4a877af134017050b528eaeaee73227c6b90b52e
1,513
require 'mustermann' require 'webrick' require 'faye/websocket' module Pluggy class App attr_accessor :server, :router, :settings, :wsstack_collection def initialize(server: Pluggy::Server, router: Pluggy::Router, route: Pluggy::Router::Route, view: Pluggy::View, matcher: Mustermann, settings: []) @settings = Pluggy::Settings.new(settings) @compilers = @settings[:compilers] @router = router.new(route_class: route, matcher_class: matcher, view_class: view, settings: @settings) @server = server @wsstack_collection = WSStackCollection.new Hook.register to: :request_start do |env| if Faye::WebSocket.websocket?(env) req = Rack::Request.new(env) ws = Faye::WebSocket.new(env) @wsstack_collection.select { |wsstack| wsstack.matches?(uri: req.path) }.each do |wsstack| wsstack.defaults.each do |event, block| ws.on event do |e| block.call(e, ws) end end wsstack.push(ws) end ws.rack_response end end end def to_compile(ext, &block) @compilers.create(ext.to_sym, &block) end def start Rack::Server.start( app: @server.new(@router, settings: @settings), server: WEBrick, port: 3150 ) end def route(*args, **opts, &block) @router.route(*args, **opts, &block) end def ws(*args) @wsstack_collection.ws(*args) end end end
28.018519
151
0.604759
91de8ba6c929dc57c2278eae2b1afba1f06d5c90
1,292
require 'rails_helper' module MnoEnterprise RSpec.describe Jpi::V1::CurrentUsersController, type: :routing do let!(:user) { build(:user, :with_deletion_request, :with_organizations) } routes { MnoEnterprise::Engine.routes } it 'routes to #show' do expect(get('/jpi/v1/current_user')).to route_to("mno_enterprise/jpi/v1/current_users#show") end it 'routes to #update' do expect(put('/jpi/v1/current_user')).to route_to("mno_enterprise/jpi/v1/current_users#update") end it 'routes to #register_developer' do expect(put('/jpi/v1/current_user/register_developer')).to route_to("mno_enterprise/jpi/v1/current_users#register_developer") end it 'routes to #update_password' do expect(put('/jpi/v1/current_user/update_password')).to route_to("mno_enterprise/jpi/v1/current_users#update_password") end # it 'routes to #create_deletion_request' do # expect(post('/jpi/v1/current_user/deletion_request')).to route_to("mno_enterprise/jpi/v1/current_users#create_deletion_request") # end # # it 'routes to #cancel_deletion_request' do # expect(delete('/jpi/v1/current_user/deletion_request')).to route_to("mno_enterprise/jpi/v1/current_users#cancel_deletion_request") # end end end
38
138
0.718266
d5e0fc73d126d6efa6adc34735ceb0240d8a7dcb
479
cask :v1 => 'istat-menus' do version :latest sha256 :no_check url 'http://download.bjango.com/istatmenus/' appcast 'http://bjango.com/istatmenus/appcast/appcast2.xml', :sha256 => '4780e5d8414c45e00e3ac792d67bd8ba0b1d59f1e9394ee1db0478352b040db2' name 'iStats Menus' homepage 'http://bjango.com/mac/istatmenus/' license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder app 'iStat Menus.app' end
34.214286
115
0.736952
1c89dd3cad53c769e34348f195214beb633d9293
343
# frozen_string_literal: true # Public part of posts component class PostsController < ApplicationController # get /posts def index @collection = Post.page_for_visitors(current_page) end # get /posts/:id-:slug def show @entity = Post.list_for_visitors.find_by(id: params[:id]) handle_http_404 if @entity.nil? end end
21.4375
61
0.731778
f8d825258d2bd0dbf6c7e67d97daf854398b923d
218
name 'code_generator' maintainer 'Logan Koester' maintainer_email '[email protected]' license 'MIT' description 'Generates Chef code for Chef DK' long_description 'Generates Chef code for Chef DK' version '1.0.0'
27.25
50
0.802752
1c7facfc4c05c17a85bb44696434d1fc120f20f7
1,570
# frozen_string_literal: true module BootstrapForm module Components module Validation extend ActiveSupport::Concern private def error?(name) object.respond_to?(:errors) && !(name.nil? || object.errors[name].empty?) end def required_attribute?(obj, attribute) return false unless obj && attribute target = obj.class == Class ? obj : obj.class target_validators = if target.respond_to? :validators_on target.validators_on(attribute).map(&:class) else [] end presence_validator?(target_validators) end def presence_validator?(target_validators) has_presence_validator = target_validators.include?( ActiveModel::Validations::PresenceValidator ) if defined? ActiveRecord::Validations::PresenceValidator has_presence_validator |= target_validators.include?( ActiveRecord::Validations::PresenceValidator ) end has_presence_validator end def inline_error?(name) error?(name) && inline_errors end def generate_error(name) return unless inline_error?(name) help_text = get_error_messages(name) help_klass = "invalid-feedback" help_tag = :div content_tag(help_tag, help_text, class: help_klass) end def get_error_messages(name) object.errors[name].join(", ") end end end end
25.322581
81
0.601274
26804b38db8f8b3ad2824036e1c510d603053a7e
10,325
# frozen_string_literal: true FactoryBot.define do factory :merge_request, traits: [:has_internal_id] do title { generate(:title) } association :source_project, :repository, factory: :project target_project { source_project } author { source_project.creator } # $ git log --pretty=oneline feature..master # 5937ac0a7beb003549fc5fd26fc247adbce4a52e Add submodule from gitlab.com # 570e7b2abdd848b95f2f578043fc23bd6f6fd24d Change some files # 6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9 More submodules # d14d6c0abdd253381df51a723d58691b2ee1ab08 Remove ds_store files # c1acaa58bbcbc3eafe538cb8274ba387047b69f8 Ignore DS files # # See also RepoHelpers.sample_compare # source_branch { "master" } target_branch { "feature" } merge_status { "can_be_merged" } trait :draft_merge_request do title { generate(:draft_title) } end trait :wip_merge_request do title { generate(:wip_title) } end trait :jira_title do title { generate(:jira_title) } end trait :jira_description do description { generate(:jira_description) } end trait :jira_branch do source_branch { generate(:jira_branch) } end trait :with_image_diffs do source_branch { "add_images_and_changes" } target_branch { "master" } end trait :without_diffs do source_branch { "improve/awesome" } target_branch { "master" } end trait :conflict do source_branch { "feature_conflict" } target_branch { "feature" } end trait :merged do state_id { MergeRequest.available_states[:merged] } end trait :with_merged_metrics do merged transient do merged_by { author } end after(:build) do |merge_request, evaluator| metrics = merge_request.build_metrics metrics.merged_at = 1.week.from_now metrics.merged_by = evaluator.merged_by metrics.pipeline = create(:ci_empty_pipeline) end end trait :merged_target do source_branch { "merged-target" } target_branch { "improve/awesome" } end trait :merged_last_month do merged after(:build) do |merge_request| merge_request.build_metrics.merged_at = 1.month.ago end end trait :closed do state_id { MergeRequest.available_states[:closed] } end trait :closed_last_month do closed after(:build) do |merge_request| merge_request.build_metrics.latest_closed_at = 1.month.ago end end trait :opened do state_id { MergeRequest.available_states[:opened] } end trait :invalid do source_branch { "feature_one" } target_branch { "feature_two" } end trait :locked do state_id { MergeRequest.available_states[:locked] } end trait :simple do source_branch { "feature" } target_branch { "master" } end trait :rebased do source_branch { "markdown" } target_branch { "improve/awesome" } end trait :diverged do source_branch { "feature" } target_branch { "master" } end trait :merge_when_pipeline_succeeds do auto_merge_enabled { true } auto_merge_strategy { AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS } merge_user { author } merge_params { { sha: diff_head_sha } } end trait :remove_source_branch do merge_params do { 'force_remove_source_branch' => '1' } end end trait :with_head_pipeline do after(:build) do |merge_request| merge_request.head_pipeline = build( :ci_pipeline, :running, project: merge_request.source_project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha) end end trait :with_test_reports do after(:build) do |merge_request| merge_request.head_pipeline = build( :ci_pipeline, :success, :with_test_reports, project: merge_request.source_project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha) end end trait :with_accessibility_reports do after(:build) do |merge_request| merge_request.head_pipeline = build( :ci_pipeline, :success, :with_accessibility_reports, project: merge_request.source_project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha) end end trait :with_codequality_reports do after(:build) do |merge_request| merge_request.head_pipeline = build( :ci_pipeline, :success, :with_codequality_reports, project: merge_request.source_project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha) end end trait :unique_branches do source_branch { generate(:branch) } target_branch { generate(:branch) } end trait :unique_author do author { association(:user) } end trait :with_coverage_reports do after(:build) do |merge_request| merge_request.head_pipeline = build( :ci_pipeline, :success, :with_coverage_report_artifact, project: merge_request.source_project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha) end end trait :with_codequality_mr_diff_reports do after(:build) do |merge_request| merge_request.head_pipeline = build( :ci_pipeline, :success, :with_codequality_mr_diff_report, project: merge_request.source_project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha) end end trait :with_terraform_reports do after(:build) do |merge_request| merge_request.head_pipeline = build( :ci_pipeline, :success, :with_terraform_reports, project: merge_request.source_project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha) end end trait :with_sast_reports do after(:build) do |merge_request| merge_request.head_pipeline = build( :ci_pipeline, :success, :with_sast_report, project: merge_request.source_project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha) end end trait :with_secret_detection_reports do after(:build) do |merge_request| merge_request.head_pipeline = build( :ci_pipeline, :success, :with_secret_detection_report, project: merge_request.source_project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha) end end trait :with_exposed_artifacts do after(:build) do |merge_request| merge_request.head_pipeline = build( :ci_pipeline, :success, :with_exposed_artifacts, project: merge_request.source_project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha) end end trait :with_legacy_detached_merge_request_pipeline do after(:create) do |merge_request| create(:ci_pipeline, :legacy_detached_merge_request_pipeline, merge_request: merge_request) end end trait :with_detached_merge_request_pipeline do after(:create) do |merge_request| create(:ci_pipeline, :detached_merge_request_pipeline, merge_request: merge_request) end end trait :with_merge_request_pipeline do transient do merge_sha { 'mergesha' } source_sha { source_branch_sha } target_sha { target_branch_sha } end after(:create) do |merge_request, evaluator| create(:ci_pipeline, :merged_result_pipeline, merge_request: merge_request, sha: evaluator.merge_sha, source_sha: evaluator.source_sha, target_sha: evaluator.target_sha ) end end trait :deployed_review_app do target_branch { 'pages-deploy-target' } transient do deployment { association(:deployment, :review_app) } end after(:build) do |merge_request, evaluator| merge_request.source_branch = evaluator.deployment.ref merge_request.source_project = evaluator.deployment.project merge_request.target_project = evaluator.deployment.project end end trait :sequence_source_branch do sequence(:source_branch) { |n| "feature#{n}" } end after(:build) do |merge_request| target_project = merge_request.target_project source_project = merge_request.source_project # Fake `fetch_ref!` if we don't have repository # We have too many existing tests relying on this behaviour unless [target_project, source_project].all?(&:repository_exists?) allow(merge_request).to receive(:fetch_ref!) end end after(:build) do |merge_request, evaluator| merge_request.state_id = MergeRequest.available_states[evaluator.state] end after(:create) do |merge_request, evaluator| merge_request.cache_merge_request_closes_issues! end factory :merged_merge_request, traits: [:merged] factory :closed_merge_request, traits: [:closed] factory :reopened_merge_request, traits: [:opened] factory :invalid_merge_request, traits: [:invalid] factory :merge_request_with_diffs factory :merge_request_with_diff_notes do after(:create) do |mr| create(:diff_note_on_merge_request, noteable: mr, project: mr.source_project) end end factory :merge_request_with_multiple_diffs do after(:create) do |mr| mr.merge_request_diffs.create!(head_commit_sha: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9') end end factory :labeled_merge_request do transient do labels { [] } end after(:create) do |merge_request, evaluator| merge_request.update!(labels: evaluator.labels) end end factory :merge_request_without_merge_request_diff, class: 'MergeRequestWithoutMergeRequestDiff' end end
28.133515
99
0.662567
21e0e945199e4a992c52488a7f31008e496db4bd
702
require "active_support" require "active_support/core_ext/object/blank" VALUES = [ nil, false, true, "", "\n", "Hello", 0, 1.25, [], [nil, false], [1, 2], {}, { colour: nil } ] puts `ruby -v` puts `rails -v` puts puts "All Values: #{VALUES}" puts puts "Truthy: #{VALUES.select { |v| !!v == true } }" puts "Falsey: #{VALUES.select { |v| !!v == false } }" puts "nil?: #{VALUES.select { |v| v.nil? == true } }" puts "any?: #{VALUES.select { |v| v.respond_to?(:any?) && v.any? == true } }" puts "empty?: #{VALUES.select { |v| v.respond_to?(:empty?) && v.empty? == true } }" puts puts "blank?: #{VALUES.select { |v| v.blank? == true } }" puts "present?: #{VALUES.select { |v| v.present? == true } }"
29.25
93
0.571225
bf5fce2ad25f9fa24f019c434d7ddd3fe2c4364d
2,051
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20170420093631) do create_table "articles", force: :cascade do |t| t.string "title" t.text "content" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "comments", force: :cascade do |t| t.string "commenter" t.text "body" t.integer "article_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["article_id"], name: "index_comments_on_article_id" end create_table "users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["email"], name: "index_users_on_email", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end end
41.857143
95
0.696246
61eb1ab6b972d5bf44f3cbd4b1c0e3c48e32c696
837
cask "c0re100-qbittorrent" do version "4.3.4.10" sha256 "6fc61b87914c13bc22427dc3a3738a6279d6b56711dc65d109d15f2e45ef6b2f" url "https://github.com/c0re100/qBittorrent-Enhanced-Edition/releases/download/release-#{version}/qBittorrent-#{version}.dmg" name "qBittorrent Enhanced Edition" homepage "https://github.com/c0re100/qBittorrent-Enhanced-Edition" livecheck do url :url strategy :git regex(/^release-(\d+(?:\.\d+)*)$/i) end depends_on macos: ">= :sierra" app "qbittorrent.app" zap trash: [ "~/.config/qBittorrent", "~/Library/Application Support/qBittorrent", "~/Library/Caches/qBittorrent", "~/Library/Preferences/org.qbittorrent.qBittorrent.plist", "~/Library/Preferences/qBittorrent", "~/Library/Saved Application State/org.qbittorrent.qBittorrent.savedState", ] end
29.892857
127
0.721625
bb864427f4f0baabb10d927aa7451c3d002a7711
26,387
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/contactcenterinsights/v1/resources.proto require 'google/protobuf' require 'google/api/field_behavior_pb' require 'google/api/resource_pb' require 'google/protobuf/duration_pb' require 'google/protobuf/timestamp_pb' require 'google/api/annotations_pb' Google::Protobuf::DescriptorPool.generated_pool.build do add_file("google/cloud/contactcenterinsights/v1/resources.proto", :syntax => :proto3) do add_message "google.cloud.contactcenterinsights.v1.Conversation" do optional :name, :string, 1 optional :data_source, :message, 2, "google.cloud.contactcenterinsights.v1.ConversationDataSource" optional :create_time, :message, 3, "google.protobuf.Timestamp" optional :update_time, :message, 4, "google.protobuf.Timestamp" optional :start_time, :message, 17, "google.protobuf.Timestamp" optional :language_code, :string, 14 optional :agent_id, :string, 5 map :labels, :string, :string, 6 optional :transcript, :message, 8, "google.cloud.contactcenterinsights.v1.Conversation.Transcript" optional :medium, :enum, 9, "google.cloud.contactcenterinsights.v1.Conversation.Medium" optional :duration, :message, 10, "google.protobuf.Duration" optional :turn_count, :int32, 11 optional :latest_analysis, :message, 12, "google.cloud.contactcenterinsights.v1.Analysis" repeated :runtime_annotations, :message, 13, "google.cloud.contactcenterinsights.v1.RuntimeAnnotation" map :dialogflow_intents, :string, :message, 18, "google.cloud.contactcenterinsights.v1.DialogflowIntent" oneof :metadata do optional :call_metadata, :message, 7, "google.cloud.contactcenterinsights.v1.Conversation.CallMetadata" end oneof :expiration do optional :expire_time, :message, 15, "google.protobuf.Timestamp" optional :ttl, :message, 16, "google.protobuf.Duration" end end add_message "google.cloud.contactcenterinsights.v1.Conversation.CallMetadata" do optional :customer_channel, :int32, 1 optional :agent_channel, :int32, 2 end add_message "google.cloud.contactcenterinsights.v1.Conversation.Transcript" do repeated :transcript_segments, :message, 1, "google.cloud.contactcenterinsights.v1.Conversation.Transcript.TranscriptSegment" end add_message "google.cloud.contactcenterinsights.v1.Conversation.Transcript.TranscriptSegment" do optional :text, :string, 1 optional :confidence, :float, 2 repeated :words, :message, 3, "google.cloud.contactcenterinsights.v1.Conversation.Transcript.TranscriptSegment.WordInfo" optional :language_code, :string, 4 optional :channel_tag, :int32, 5 optional :segment_participant, :message, 9, "google.cloud.contactcenterinsights.v1.ConversationParticipant" end add_message "google.cloud.contactcenterinsights.v1.Conversation.Transcript.TranscriptSegment.WordInfo" do optional :start_offset, :message, 1, "google.protobuf.Duration" optional :end_offset, :message, 2, "google.protobuf.Duration" optional :word, :string, 3 optional :confidence, :float, 4 end add_enum "google.cloud.contactcenterinsights.v1.Conversation.Medium" do value :MEDIUM_UNSPECIFIED, 0 value :PHONE_CALL, 1 value :CHAT, 2 end add_message "google.cloud.contactcenterinsights.v1.Analysis" do optional :name, :string, 1 optional :request_time, :message, 2, "google.protobuf.Timestamp" optional :create_time, :message, 3, "google.protobuf.Timestamp" optional :analysis_result, :message, 7, "google.cloud.contactcenterinsights.v1.AnalysisResult" end add_message "google.cloud.contactcenterinsights.v1.ConversationDataSource" do oneof :source do optional :gcs_source, :message, 1, "google.cloud.contactcenterinsights.v1.GcsSource" optional :dialogflow_source, :message, 3, "google.cloud.contactcenterinsights.v1.DialogflowSource" end end add_message "google.cloud.contactcenterinsights.v1.GcsSource" do optional :audio_uri, :string, 1 optional :transcript_uri, :string, 2 end add_message "google.cloud.contactcenterinsights.v1.DialogflowSource" do optional :dialogflow_conversation, :string, 1 optional :audio_uri, :string, 3 end add_message "google.cloud.contactcenterinsights.v1.AnalysisResult" do optional :end_time, :message, 1, "google.protobuf.Timestamp" oneof :metadata do optional :call_analysis_metadata, :message, 2, "google.cloud.contactcenterinsights.v1.AnalysisResult.CallAnalysisMetadata" end end add_message "google.cloud.contactcenterinsights.v1.AnalysisResult.CallAnalysisMetadata" do repeated :annotations, :message, 2, "google.cloud.contactcenterinsights.v1.CallAnnotation" map :entities, :string, :message, 3, "google.cloud.contactcenterinsights.v1.Entity" repeated :sentiments, :message, 4, "google.cloud.contactcenterinsights.v1.ConversationLevelSentiment" map :intents, :string, :message, 6, "google.cloud.contactcenterinsights.v1.Intent" map :phrase_matchers, :string, :message, 7, "google.cloud.contactcenterinsights.v1.PhraseMatchData" optional :issue_model_result, :message, 8, "google.cloud.contactcenterinsights.v1.IssueModelResult" end add_message "google.cloud.contactcenterinsights.v1.IssueModelResult" do optional :issue_model, :string, 1 repeated :issues, :message, 2, "google.cloud.contactcenterinsights.v1.IssueAssignment" end add_message "google.cloud.contactcenterinsights.v1.ConversationLevelSentiment" do optional :channel_tag, :int32, 1 optional :sentiment_data, :message, 2, "google.cloud.contactcenterinsights.v1.SentimentData" end add_message "google.cloud.contactcenterinsights.v1.IssueAssignment" do optional :issue, :string, 1 optional :score, :double, 2 end add_message "google.cloud.contactcenterinsights.v1.CallAnnotation" do optional :channel_tag, :int32, 1 optional :annotation_start_boundary, :message, 4, "google.cloud.contactcenterinsights.v1.AnnotationBoundary" optional :annotation_end_boundary, :message, 5, "google.cloud.contactcenterinsights.v1.AnnotationBoundary" oneof :data do optional :interruption_data, :message, 10, "google.cloud.contactcenterinsights.v1.InterruptionData" optional :sentiment_data, :message, 11, "google.cloud.contactcenterinsights.v1.SentimentData" optional :silence_data, :message, 12, "google.cloud.contactcenterinsights.v1.SilenceData" optional :hold_data, :message, 13, "google.cloud.contactcenterinsights.v1.HoldData" optional :entity_mention_data, :message, 15, "google.cloud.contactcenterinsights.v1.EntityMentionData" optional :intent_match_data, :message, 16, "google.cloud.contactcenterinsights.v1.IntentMatchData" optional :phrase_match_data, :message, 17, "google.cloud.contactcenterinsights.v1.PhraseMatchData" end end add_message "google.cloud.contactcenterinsights.v1.AnnotationBoundary" do optional :transcript_index, :int32, 1 oneof :detailed_boundary do optional :word_index, :int32, 3 end end add_message "google.cloud.contactcenterinsights.v1.Entity" do optional :display_name, :string, 1 optional :type, :enum, 2, "google.cloud.contactcenterinsights.v1.Entity.Type" map :metadata, :string, :string, 3 optional :salience, :float, 4 optional :sentiment, :message, 5, "google.cloud.contactcenterinsights.v1.SentimentData" end add_enum "google.cloud.contactcenterinsights.v1.Entity.Type" do value :TYPE_UNSPECIFIED, 0 value :PERSON, 1 value :LOCATION, 2 value :ORGANIZATION, 3 value :EVENT, 4 value :WORK_OF_ART, 5 value :CONSUMER_GOOD, 6 value :OTHER, 7 value :PHONE_NUMBER, 9 value :ADDRESS, 10 value :DATE, 11 value :NUMBER, 12 value :PRICE, 13 end add_message "google.cloud.contactcenterinsights.v1.Intent" do optional :id, :string, 1 optional :display_name, :string, 2 end add_message "google.cloud.contactcenterinsights.v1.PhraseMatchData" do optional :phrase_matcher, :string, 1 optional :display_name, :string, 2 end add_message "google.cloud.contactcenterinsights.v1.DialogflowIntent" do optional :display_name, :string, 1 end add_message "google.cloud.contactcenterinsights.v1.InterruptionData" do end add_message "google.cloud.contactcenterinsights.v1.SilenceData" do end add_message "google.cloud.contactcenterinsights.v1.HoldData" do end add_message "google.cloud.contactcenterinsights.v1.EntityMentionData" do optional :entity_unique_id, :string, 1 optional :type, :enum, 2, "google.cloud.contactcenterinsights.v1.EntityMentionData.MentionType" optional :sentiment, :message, 3, "google.cloud.contactcenterinsights.v1.SentimentData" end add_enum "google.cloud.contactcenterinsights.v1.EntityMentionData.MentionType" do value :MENTION_TYPE_UNSPECIFIED, 0 value :PROPER, 1 value :COMMON, 2 end add_message "google.cloud.contactcenterinsights.v1.IntentMatchData" do optional :intent_unique_id, :string, 1 end add_message "google.cloud.contactcenterinsights.v1.SentimentData" do optional :magnitude, :float, 1 optional :score, :float, 2 end add_message "google.cloud.contactcenterinsights.v1.IssueModel" do optional :name, :string, 1 optional :display_name, :string, 2 optional :create_time, :message, 3, "google.protobuf.Timestamp" optional :update_time, :message, 4, "google.protobuf.Timestamp" optional :state, :enum, 5, "google.cloud.contactcenterinsights.v1.IssueModel.State" optional :input_data_config, :message, 6, "google.cloud.contactcenterinsights.v1.IssueModel.InputDataConfig" optional :training_stats, :message, 7, "google.cloud.contactcenterinsights.v1.IssueModelLabelStats" end add_message "google.cloud.contactcenterinsights.v1.IssueModel.InputDataConfig" do optional :medium, :enum, 1, "google.cloud.contactcenterinsights.v1.Conversation.Medium" optional :training_conversations_count, :int64, 2 end add_enum "google.cloud.contactcenterinsights.v1.IssueModel.State" do value :STATE_UNSPECIFIED, 0 value :UNDEPLOYED, 1 value :DEPLOYING, 2 value :DEPLOYED, 3 value :UNDEPLOYING, 4 value :DELETING, 5 end add_message "google.cloud.contactcenterinsights.v1.Issue" do optional :name, :string, 1 optional :display_name, :string, 2 optional :create_time, :message, 3, "google.protobuf.Timestamp" optional :update_time, :message, 4, "google.protobuf.Timestamp" end add_message "google.cloud.contactcenterinsights.v1.IssueModelLabelStats" do optional :analyzed_conversations_count, :int64, 1 optional :unclassified_conversations_count, :int64, 2 map :issue_stats, :string, :message, 3, "google.cloud.contactcenterinsights.v1.IssueModelLabelStats.IssueStats" end add_message "google.cloud.contactcenterinsights.v1.IssueModelLabelStats.IssueStats" do optional :issue, :string, 1 optional :labeled_conversations_count, :int64, 2 end add_message "google.cloud.contactcenterinsights.v1.PhraseMatcher" do optional :name, :string, 1 optional :revision_id, :string, 2 optional :version_tag, :string, 3 optional :revision_create_time, :message, 4, "google.protobuf.Timestamp" optional :display_name, :string, 5 optional :type, :enum, 6, "google.cloud.contactcenterinsights.v1.PhraseMatcher.PhraseMatcherType" optional :active, :bool, 7 repeated :phrase_match_rule_groups, :message, 8, "google.cloud.contactcenterinsights.v1.PhraseMatchRuleGroup" optional :activation_update_time, :message, 9, "google.protobuf.Timestamp" optional :role_match, :enum, 10, "google.cloud.contactcenterinsights.v1.ConversationParticipant.Role" end add_enum "google.cloud.contactcenterinsights.v1.PhraseMatcher.PhraseMatcherType" do value :PHRASE_MATCHER_TYPE_UNSPECIFIED, 0 value :ALL_OF, 1 value :ANY_OF, 2 end add_message "google.cloud.contactcenterinsights.v1.PhraseMatchRuleGroup" do optional :type, :enum, 1, "google.cloud.contactcenterinsights.v1.PhraseMatchRuleGroup.PhraseMatchRuleGroupType" repeated :phrase_match_rules, :message, 2, "google.cloud.contactcenterinsights.v1.PhraseMatchRule" end add_enum "google.cloud.contactcenterinsights.v1.PhraseMatchRuleGroup.PhraseMatchRuleGroupType" do value :PHRASE_MATCH_RULE_GROUP_TYPE_UNSPECIFIED, 0 value :ALL_OF, 1 value :ANY_OF, 2 end add_message "google.cloud.contactcenterinsights.v1.PhraseMatchRule" do optional :query, :string, 1 optional :negated, :bool, 2 optional :config, :message, 3, "google.cloud.contactcenterinsights.v1.PhraseMatchRuleConfig" end add_message "google.cloud.contactcenterinsights.v1.PhraseMatchRuleConfig" do oneof :config do optional :exact_match_config, :message, 1, "google.cloud.contactcenterinsights.v1.ExactMatchConfig" end end add_message "google.cloud.contactcenterinsights.v1.ExactMatchConfig" do optional :case_sensitive, :bool, 1 end add_message "google.cloud.contactcenterinsights.v1.Settings" do optional :name, :string, 1 optional :create_time, :message, 2, "google.protobuf.Timestamp" optional :update_time, :message, 3, "google.protobuf.Timestamp" optional :language_code, :string, 4 optional :conversation_ttl, :message, 5, "google.protobuf.Duration" map :pubsub_notification_settings, :string, :string, 6 optional :analysis_config, :message, 7, "google.cloud.contactcenterinsights.v1.Settings.AnalysisConfig" end add_message "google.cloud.contactcenterinsights.v1.Settings.AnalysisConfig" do optional :runtime_integration_analysis_percentage, :double, 1 end add_message "google.cloud.contactcenterinsights.v1.RuntimeAnnotation" do optional :annotation_id, :string, 1 optional :create_time, :message, 2, "google.protobuf.Timestamp" optional :start_boundary, :message, 3, "google.cloud.contactcenterinsights.v1.AnnotationBoundary" optional :end_boundary, :message, 4, "google.cloud.contactcenterinsights.v1.AnnotationBoundary" optional :answer_feedback, :message, 5, "google.cloud.contactcenterinsights.v1.AnswerFeedback" oneof :data do optional :article_suggestion, :message, 6, "google.cloud.contactcenterinsights.v1.ArticleSuggestionData" optional :faq_answer, :message, 7, "google.cloud.contactcenterinsights.v1.FaqAnswerData" optional :smart_reply, :message, 8, "google.cloud.contactcenterinsights.v1.SmartReplyData" optional :smart_compose_suggestion, :message, 9, "google.cloud.contactcenterinsights.v1.SmartComposeSuggestionData" optional :dialogflow_interaction, :message, 10, "google.cloud.contactcenterinsights.v1.DialogflowInteractionData" end end add_message "google.cloud.contactcenterinsights.v1.AnswerFeedback" do optional :correctness_level, :enum, 1, "google.cloud.contactcenterinsights.v1.AnswerFeedback.CorrectnessLevel" optional :clicked, :bool, 2 optional :displayed, :bool, 3 end add_enum "google.cloud.contactcenterinsights.v1.AnswerFeedback.CorrectnessLevel" do value :CORRECTNESS_LEVEL_UNSPECIFIED, 0 value :NOT_CORRECT, 1 value :PARTIALLY_CORRECT, 2 value :FULLY_CORRECT, 3 end add_message "google.cloud.contactcenterinsights.v1.ArticleSuggestionData" do optional :title, :string, 1 optional :uri, :string, 2 optional :confidence_score, :float, 3 map :metadata, :string, :string, 4 optional :query_record, :string, 5 optional :source, :string, 6 end add_message "google.cloud.contactcenterinsights.v1.FaqAnswerData" do optional :answer, :string, 1 optional :confidence_score, :float, 2 optional :question, :string, 3 map :metadata, :string, :string, 4 optional :query_record, :string, 5 optional :source, :string, 6 end add_message "google.cloud.contactcenterinsights.v1.SmartReplyData" do optional :reply, :string, 1 optional :confidence_score, :double, 2 map :metadata, :string, :string, 3 optional :query_record, :string, 4 end add_message "google.cloud.contactcenterinsights.v1.SmartComposeSuggestionData" do optional :suggestion, :string, 1 optional :confidence_score, :double, 2 map :metadata, :string, :string, 3 optional :query_record, :string, 4 end add_message "google.cloud.contactcenterinsights.v1.DialogflowInteractionData" do optional :dialogflow_intent_id, :string, 1 optional :confidence, :float, 2 end add_message "google.cloud.contactcenterinsights.v1.ConversationParticipant" do optional :dialogflow_participant, :string, 1 optional :role, :enum, 2, "google.cloud.contactcenterinsights.v1.ConversationParticipant.Role" oneof :participant do optional :dialogflow_participant_name, :string, 5 optional :user_id, :string, 6 end end add_enum "google.cloud.contactcenterinsights.v1.ConversationParticipant.Role" do value :ROLE_UNSPECIFIED, 0 value :HUMAN_AGENT, 1 value :AUTOMATED_AGENT, 2 value :END_USER, 3 value :ANY_AGENT, 4 end end end module Google module Cloud module ContactCenterInsights module V1 Conversation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Conversation").msgclass Conversation::CallMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Conversation.CallMetadata").msgclass Conversation::Transcript = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Conversation.Transcript").msgclass Conversation::Transcript::TranscriptSegment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Conversation.Transcript.TranscriptSegment").msgclass Conversation::Transcript::TranscriptSegment::WordInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Conversation.Transcript.TranscriptSegment.WordInfo").msgclass Conversation::Medium = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Conversation.Medium").enummodule Analysis = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Analysis").msgclass ConversationDataSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.ConversationDataSource").msgclass GcsSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.GcsSource").msgclass DialogflowSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.DialogflowSource").msgclass AnalysisResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.AnalysisResult").msgclass AnalysisResult::CallAnalysisMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.AnalysisResult.CallAnalysisMetadata").msgclass IssueModelResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.IssueModelResult").msgclass ConversationLevelSentiment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.ConversationLevelSentiment").msgclass IssueAssignment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.IssueAssignment").msgclass CallAnnotation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.CallAnnotation").msgclass AnnotationBoundary = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.AnnotationBoundary").msgclass Entity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Entity").msgclass Entity::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Entity.Type").enummodule Intent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Intent").msgclass PhraseMatchData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.PhraseMatchData").msgclass DialogflowIntent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.DialogflowIntent").msgclass InterruptionData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.InterruptionData").msgclass SilenceData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.SilenceData").msgclass HoldData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.HoldData").msgclass EntityMentionData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.EntityMentionData").msgclass EntityMentionData::MentionType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.EntityMentionData.MentionType").enummodule IntentMatchData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.IntentMatchData").msgclass SentimentData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.SentimentData").msgclass IssueModel = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.IssueModel").msgclass IssueModel::InputDataConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.IssueModel.InputDataConfig").msgclass IssueModel::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.IssueModel.State").enummodule Issue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Issue").msgclass IssueModelLabelStats = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.IssueModelLabelStats").msgclass IssueModelLabelStats::IssueStats = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.IssueModelLabelStats.IssueStats").msgclass PhraseMatcher = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.PhraseMatcher").msgclass PhraseMatcher::PhraseMatcherType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.PhraseMatcher.PhraseMatcherType").enummodule PhraseMatchRuleGroup = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.PhraseMatchRuleGroup").msgclass PhraseMatchRuleGroup::PhraseMatchRuleGroupType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.PhraseMatchRuleGroup.PhraseMatchRuleGroupType").enummodule PhraseMatchRule = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.PhraseMatchRule").msgclass PhraseMatchRuleConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.PhraseMatchRuleConfig").msgclass ExactMatchConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.ExactMatchConfig").msgclass Settings = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Settings").msgclass Settings::AnalysisConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.Settings.AnalysisConfig").msgclass RuntimeAnnotation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.RuntimeAnnotation").msgclass AnswerFeedback = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.AnswerFeedback").msgclass AnswerFeedback::CorrectnessLevel = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.AnswerFeedback.CorrectnessLevel").enummodule ArticleSuggestionData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.ArticleSuggestionData").msgclass FaqAnswerData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.FaqAnswerData").msgclass SmartReplyData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.SmartReplyData").msgclass SmartComposeSuggestionData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.SmartComposeSuggestionData").msgclass DialogflowInteractionData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.DialogflowInteractionData").msgclass ConversationParticipant = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.ConversationParticipant").msgclass ConversationParticipant::Role = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.contactcenterinsights.v1.ConversationParticipant.Role").enummodule end end end end
64.515892
221
0.759768
1d644352e84285ee15c98112385c87a2721b175b
5,243
# This code lets us redefine existing Rake tasks, which is extremely # handy for modifying existing Rails rake tasks. # Credit for this snippet of code goes to Jeremy Kemper # http://pastie.caboo.se/9620 unless Rake::TaskManager.methods.include?(:redefine_task) module Rake module TaskManager def redefine_task(task_class, args, &block) task_name, deps = resolve_args(args) task_name = task_class.scope_name(@scope, task_name) deps = [deps] unless deps.respond_to?(:to_ary) deps = deps.collect {|d| d.to_s } task = @tasks[task_name.to_s] = task_class.new(task_name, self) task.application = self task.add_comment(@last_comment) @last_comment = nil task.enhance(deps, &block) task end end class Task class << self def redefine_task(args, &block) Rake.application.redefine_task(self, args, &block) end end end end end namespace :db do namespace :fixtures do namespace :plugins do desc "Load plugin fixtures into the current environment's database." task :load => :environment do require 'active_record/fixtures' ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) Dir.glob(File.join(RAILS_ROOT, 'vendor', 'plugins', ENV['PLUGIN'] || '**', 'test', 'fixtures', '*.yml')).each do |fixture_file| Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*')) end end end end end # this is just a modification of the original task in railties/lib/tasks/documentation.rake, # because the default task doesn't support subdirectories like <plugin>/app or # <plugin>/component. These tasks now include every file under a plugin's code paths (see # Plugin#code_paths). namespace :doc do plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) } namespace :plugins do # Define doc tasks for each plugin plugins.each do |plugin| desc "Create plugin documentation for '#{plugin}'" Rake::Task.redefine_task(plugin => :environment) do plugin_base = RAILS_ROOT + "/vendor/plugins/#{plugin}" options = [] files = Rake::FileList.new options << "-o doc/plugins/#{plugin}" options << "--title '#{plugin.titlecase} Plugin Documentation'" options << '--line-numbers' << '--inline-source' options << '-T html' # Include every file in the plugin's code_paths (see Plugin#code_paths) if Rails.plugins[plugin] files.include("#{plugin_base}/{#{Rails.plugins[plugin].code_paths.join(",")}}/**/*.rb") end if File.exists?("#{plugin_base}/README") files.include("#{plugin_base}/README") options << "--main '#{plugin_base}/README'" end files.include("#{plugin_base}/CHANGELOG") if File.exists?("#{plugin_base}/CHANGELOG") if files.empty? puts "No source files found in #{plugin_base}. No documentation will be generated." else options << files.to_s sh %(rdoc #{options * ' '}) end end end end end namespace :test do task :warn_about_multiple_plugin_testing_with_engines do puts %{-~============== A Moste Polite Warninge ===========================~- You may experience issues testing multiple plugins at once when using the code-mixing features that the engines plugin provides. If you do experience any problems, please test plugins individually, i.e. $ rake test:plugins PLUGIN=my_plugin or use the per-type plugin test tasks: $ rake test:plugins:units $ rake test:plugins:functionals $ rake test:plugins:integration $ rake test:plugins:all Report any issues on http://dev.rails-engines.org. Thanks! -~===============( ... as you were ... )============================~-} end namespace :plugins do desc "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)" task :all => [:warn_about_multiple_plugin_testing_with_engines, :units, :functionals, :integration] desc "Run all plugin unit tests" Rake::TestTask.new(:units => :setup_plugin_fixtures) do |t| t.pattern = "vendor/plugins/#{ENV['PLUGIN'] || "**"}/test/unit/**/*_test.rb" t.verbose = true end desc "Run all plugin functional tests" Rake::TestTask.new(:functionals => :setup_plugin_fixtures) do |t| t.pattern = "vendor/plugins/#{ENV['PLUGIN'] || "**"}/test/functional/**/*_test.rb" t.verbose = true end desc "Integration test engines" Rake::TestTask.new(:integration => :setup_plugin_fixtures) do |t| t.pattern = "vendor/plugins/#{ENV['PLUGIN'] || "**"}/test/integration/**/*_test.rb" t.verbose = true end desc "Mirrors plugin fixtures into a single location to help plugin tests" task :setup_plugin_fixtures => :environment do Engines::Testing.setup_plugin_fixtures end # Patch the default plugin testing task to have setup_plugin_fixtures as a prerequisite Rake::Task["test:plugins"].prerequisites << "test:plugins:setup_plugin_fixtures" end end
35.187919
97
0.641808
ed11b4bc014eccb11cb118766bad71c6f188ce60
2,260
class Fizz < Formula desc "C++14 implementation of the TLS-1.3 standard" homepage "https://github.com/facebookincubator/fizz" url "https://github.com/facebookincubator/fizz/releases/download/v2020.12.14.00/fizz-v2020.12.14.00.tar.gz" sha256 "e84f4b89abd6bc50f324fb39b4f2918a8b9bf171fbb8ae0b64eb8985cc40df9d" license "BSD-2-Clause" head "https://github.com/facebookincubator/fizz.git" bottle do cellar :any sha256 "b43968db6f9f3a35f5ec5a78073088b03125cc9ed63037c8ee48c9b58b24cfc0" => :big_sur sha256 "210b210cea35283be200a539f01c8409930bdb29df7dfde1471c5ccfc07ab218" => :arm64_big_sur sha256 "831acbe6bdc451b2b340fa10b4d1cd7e792c98f2cd1fd91d9de00978d9f7981b" => :catalina sha256 "7da6bfaa0e023a99f67e64f596f9a9ca5acfcd14e56b995336f61d9cf0bb8f85" => :mojave end depends_on "cmake" => :build depends_on "boost" depends_on "double-conversion" depends_on "fmt" depends_on "folly" depends_on "gflags" depends_on "glog" depends_on "libevent" depends_on "libsodium" depends_on "lz4" depends_on "[email protected]" depends_on "snappy" depends_on "zstd" def install mkdir "fizz/build" do system "cmake", "..", "-DBUILD_TESTS=OFF", "-DBUILD_SHARED_LIBS=ON", *std_cmake_args system "make" system "make", "install" end end test do (testpath/"test.cpp").write <<~EOS #include <fizz/client/AsyncFizzClient.h> #include <iostream> int main() { auto context = fizz::client::FizzClientContext(); std::cout << toString(context.getSupportedVersions()[0]) << std::endl; } EOS system ENV.cxx, "-std=c++14", "test.cpp", "-o", "test", "-I#{include}", "-I#{Formula["[email protected]"].opt_include}", "-L#{lib}", "-lfizz", "-L#{Formula["folly"].opt_lib}", "-lfolly", "-L#{Formula["gflags"].opt_lib}", "-lgflags", "-L#{Formula["glog"].opt_lib}", "-lglog", "-L#{Formula["libevent"].opt_lib}", "-levent", "-L#{Formula["libsodium"].opt_lib}", "-lsodium", "-L#{Formula["[email protected]"].opt_lib}", "-lcrypto", "-lssl" assert_match "TLS", shell_output("./test") end end
36.451613
109
0.638496
7927ac47d0bfd069d446421639900583ed3c4abb
3,144
require "spec_helper" describe HitList::Counter do let(:connection) { double "connection" } let(:name) { 'article' } let(:days_of_interest) { 7 } subject { described_class.new(connection, name, days_of_interest) } before(:each) do allow(connection).to receive(:get) { '' } allow(connection).to receive(:incr) { '' } allow(connection).to receive(:zincrby) { '' } allow(connection).to receive(:pipelined).and_yield end describe "#initialize" do it "requires connection, name and days of interest as arguments" do expect { subject }.not_to raise_error end end describe "#namespace" do it "returns default namespace for counter keys" do expect(subject.namespace).to eq("hit_list") end end describe "#total_hits" do it "calls #get to connection with key like '<namespace>:<name>:total:<id>'" do expect(connection).to receive(:get).with('hit_list:article:total:12') subject.total_hits(12) end end describe "#hit!" do it "calls #increment_total_hits!" do expect(subject).to receive(:increment_total_hits!).with(13) subject.hit!(13) end it "calls #increment_rank!" do expect(subject).to receive(:increment_rank!).with(13) subject.hit!(13) end end describe "#increment_total_hits!" do it "calls #incr to connection with key like '<namespace>:<name>:total:<id>'" do expect(connection).to receive(:incr).with('hit_list:article:total:14') subject.increment_total_hits!(14) end end describe "#increment_rank!" do it "calls #zincrby on connection with key like '<namespace>:<name>:date:<date>:<id>' multiple times with right dates" do Timecop.freeze(Date.parse('2013-07-29')) do expect(connection).to receive(:zincrby).with("hit_list:article:date:2013-07-29", 1, 66) expect(connection).to receive(:zincrby).with("hit_list:article:date:2013-07-30", 1, 66) expect(connection).to receive(:zincrby).with("hit_list:article:date:2013-07-31", 1, 66) expect(connection).to receive(:zincrby).with("hit_list:article:date:2013-08-01", 1, 66) expect(connection).to receive(:zincrby).with("hit_list:article:date:2013-08-02", 1, 66) expect(connection).to receive(:zincrby).with("hit_list:article:date:2013-08-03", 1, 66) expect(connection).to receive(:zincrby).with("hit_list:article:date:2013-08-04", 1, 66) subject.increment_rank!(66) end end end describe "#top_records" do context "when time not specified" do it "should get top records in period" do Timecop.freeze(Date.parse('2013-07-29')) do expect(connection).to receive(:zrevrange).with("hit_list:article:date:2013-07-29", 0, 4) subject.top_records(5) end end end context "when time is specified" do it "should get top records in period" do Timecop.freeze(Date.parse('2013-07-29')) do expect(connection).to receive(:zrevrange).with("hit_list:article:date:2013-02-22", 0, 2) subject.top_records(3, Date.parse('2013-02-22')) end end end end end
35.325843
124
0.663804
bbdb12ebc6c83530666307c1cceaea8665c7b904
4,180
require "pathname" require "log4r" require "vagrant/util/platform" require "vagrant/util/scoped_hash_override" module VagrantPlugins module Parallels module Action class ShareFolders include Vagrant::Util::ScopedHashOverride def initialize(app, env) @logger = Log4r::Logger.new("vagrant::action::vm::share_folders") @app = app end def call(env) @env = env prepare_folders create_metadata @app.call(env) mount_shared_folders end # This method returns an actual list of Parallels Desktop # shared folders to create and their proper path. def shared_folders {}.tap do |result| @env[:machine].config.vm.synced_folders.each do |id, data| data = scoped_hash_override(data, :parallels) # Ignore NFS shared folders next if data[:nfs] # Ignore disabled shared folders next if data[:disabled] # This to prevent overwriting the actual shared folders data id = Pathname.new(id).to_s.split('/').drop_while{|i| i.empty?}.join('_') result[id] = data.dup end end end # Prepares the shared folders by verifying they exist and creating them # if they don't. def prepare_folders shared_folders.each do |id, options| hostpath = Pathname.new(options[:hostpath]).expand_path(@env[:root_path]) if !hostpath.directory? && options[:create] # Host path doesn't exist, so let's create it. @logger.debug("Host path doesn't exist, creating: #{hostpath}") begin hostpath.mkpath rescue Errno::EACCES raise Vagrant::Errors::SharedFolderCreateFailed, :path => hostpath.to_s end end end end def create_metadata @env[:ui].info I18n.t("vagrant.actions.vm.share_folders.creating") folders = [] shared_folders.each do |id, data| hostpath = File.expand_path(data[:hostpath], @env[:root_path]) hostpath = Vagrant::Util::Platform.cygwin_windows_path(hostpath) folders << { :name => id, :hostpath => hostpath, :transient => data[:transient] } end @env[:machine].provider.driver.share_folders(folders) end # TODO: Fix this, doesn't execute at the correct time def mount_shared_folders @env[:ui].info I18n.t("vagrant.actions.vm.share_folders.mounting") # short guestpaths first, so we don't step on ourselves folders = shared_folders.sort_by do |id, data| if data[:guestpath] data[:guestpath].length else # A long enough path to just do this at the end. 10000 end end # Go through each folder and mount folders.each do |id, data| if data[:guestpath] # Guest path specified, so mount the folder to specified point @env[:ui].info(I18n.t("vagrant.actions.vm.share_folders.mounting_entry", :guest_path => data[:guestpath])) # Dup the data so we can pass it to the guest API data = data.dup # Calculate the owner and group ssh_info = @env[:machine].ssh_info data[:owner] ||= ssh_info[:username] data[:group] ||= ssh_info[:username] # Mount the actual folder @env[:machine].guest.capability( :mount_parallels_shared_folder, id, data[:guestpath], data) else # If no guest path is specified, then automounting is disabled @env[:ui].info(I18n.t("vagrant.actions.vm.share_folders.nomount_entry", :host_path => data[:hostpath])) end end end end end end end
31.908397
86
0.549282
79c3e284626dec0e1b7f7d0c2ac20576f22d36e4
612
module Mongoid module Validations module Macros extend ActiveSupport::Concern # Validates the size of a collection. # # @example # class Person # include Mongoid::Document # has_many :addresses # # validates_collection_size_of :addresses, minimum: 1 # end # # @param [ Array ] args The names of the fields to validate. # # @since 2.4.0 def validates_collection_size_of(*args) validates_with(Mongoid::Validations::CollectionSizeValidator, _merge_attributes(args)) end end end end
24.48
94
0.614379
038dbe42bd1885538febe37fe7b61097d6c69fd1
2,313
require 'spec_helper' RSpec.describe 'Bitubu integration specs' do let(:client) { Cryptoexchange::Client.new } let(:ltc_btc_pair) { Cryptoexchange::Models::MarketPair.new(base: 'ltc', target: 'btc', market: 'bitubu') } it 'fetch pairs' do pairs = client.pairs('bitubu') expect(pairs).not_to be_empty pair = pairs.first expect(pair.base).to_not be nil expect(pair.target).to_not be nil expect(pair.market).to eq 'bitubu' end it 'give trade url' do trade_page_url = client.trade_page_url 'bitubu', base: ltc_btc_pair.base, target: ltc_btc_pair.target expect(trade_page_url).to eq "https://bitubu.com/trading/ltcbtc" end it 'fetch ticker' do ticker = client.ticker(ltc_btc_pair) expect(ticker.base).to eq 'LTC' expect(ticker.target).to eq 'BTC' expect(ticker.market).to eq 'bitubu' expect(ticker.last).to be_a Numeric expect(ticker.high).to be_a Numeric expect(ticker.low).to be_a Numeric expect(ticker.volume).to be_a Numeric expect(ticker.timestamp).to be nil expect(ticker.payload).to_not be nil end it 'fetch order book' do order_book = client.order_book(ltc_btc_pair) expect(order_book.base).to eq 'LTC' expect(order_book.target).to eq 'BTC' expect(order_book.market).to eq 'bitubu' expect(order_book.asks).to_not be_empty expect(order_book.bids).to_not be_empty expect(order_book.asks.first.price).to_not be_nil expect(order_book.bids.first.amount).to_not be_nil expect(order_book.bids.first.timestamp).to_not be_nil expect(order_book.asks.count).to be > 0 expect(order_book.bids.count).to be > 0 expect(order_book.timestamp).to be_nil expect(order_book.payload).to_not be nil end it 'fetch trade' do trades = client.trades(ltc_btc_pair) trade = trades.sample expect(trades).to_not be_empty expect(trade.base).to eq 'LTC' expect(trade.target).to eq 'BTC' expect(trade.market).to eq 'bitubu' expect(trade.trade_id).to_not be_nil expect(['buy', 'sell']).to include trade.type expect(trade.price).to_not be_nil expect(trade.amount).to_not be_nil expect(trade.timestamp).to be_a Numeric expect(2000..Date.today.year).to include(Time.at(trade.timestamp).year) expect(trade.payload).to_not be nil end end
32.577465
109
0.712495
91ba46129b0dadd5c0ed4714d2c1cdb881aaa68d
1,815
Pod::Spec.new do |s| s.name = 'YHCommonSDK' s.version = '1.1.1.6' s.summary = '易惠基础组件:基础配置,项目基类。' s.description = '修改点:新增SM4加密,SM3验签。' s.homepage = 'https://120.42.37.94:2443/svn/APP/iOS/YHComponent/YHCommonSDK' # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'XmYhkj' => '[email protected]' } s.source = { :svn => 'https://120.42.37.94:2443/svn/APP/iOS/YHComponent/YHCommonSDK', :tag => s.version.to_s } # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' s.ios.deployment_target = '8.0' s.prefix_header_file = 'YHCommonSDK/Classes/YHCommon.pch' s.source_files = 'YHCommonSDK/Classes/**/*.{h,m}' s.resources = 'YHCommonSDK/Assets/**/*.{bundle}' # s.resource_bundles = { # 'YHCommonSDK' => ['YHCommonSDK/Assets/*.png'] # } # s.public_header_files = 'Pod/Classes/**/*.h' # s.frameworks = 'UIKit', 'MapKit' s.dependency 'YYModel', '~> 1.0' #1.0.4 s.dependency 'Reachability', '~> 3.2' #3.2 s.dependency 'AFNetworking', '~> 3.2' #3.2.1 s.dependency 'MJRefresh', '~> 3.1' #3.1.15.7 s.dependency 'SVProgressHUD', '~> 2.2' #2.2.5 s.dependency 'OpenUDID', '~> 1.0' #1.0.0 s.dependency 'SAMKeychain', '~> 1.5' #1.5.3 s.dependency 'SDAutoLayout', '~> 2.2' #2.2.1 s.dependency 'YHNetSDK' , '~> 1.0' #1.0.5 s.dependency 'YHCategorySDK' , '~> 1.0' #1.0.1 s.dependency 'YHAlertSDK' , '~> 1.0' #1.0.3 s.dependency 'YHBaseSDK' , '~> 1.1' #1.1.5 s.dependency 'YHUtiliitiesSDK' , '~> 1.0' #1.0.2 s.dependency 'YHEnDecriptionSDK' ,'~> 1.1.0' #2.0.4 end
43.214286
122
0.555923
91ee2ea8f56c687599d7e8a38e24ba3232801e86
1,743
module ActionView #:nodoc: # = Action View PathSet # # This class is used to store and access paths in Action View. A number of # operations are defined so that you can search among the paths in this # set and also perform operations on other +PathSet+ objects. # # A +LookupContext+ will use a +PathSet+ to store the paths in its context. class PathSet #:nodoc: include Enumerable attr_reader :paths delegate :[], :include?, :pop, :size, :each, to: :paths def initialize(paths = []) @paths = typecast paths end def initialize_copy(other) @paths = other.paths.dup self end def to_ary paths.dup end def compact PathSet.new paths.compact end def +(array) PathSet.new(paths + array) end %w(<< concat push insert unshift).each do |method| class_eval <<-METHOD, __FILE__, __LINE__ + 1 def #{method}(*args) paths.#{method}(*typecast(args)) end METHOD end def find(*args) find_all(*args).first || raise(MissingTemplate.new(self, *args)) end def find_all(path, prefixes = [], *args) prefixes = [prefixes] if String === prefixes prefixes.each do |prefix| paths.each do |resolver| templates = resolver.find_all(path, prefix, *args) return templates unless templates.empty? end end [] end def exists?(path, prefixes, *args) find_all(path, prefixes, *args).any? end private def typecast(paths) paths.map do |path| case path when Pathname, String OptimizedFileSystemResolver.new path.to_s else path end end end end end
22.346154
77
0.602983
f7521e0ed28de367af459fe27ef1a9326d14d0ce
1,077
# install base packages ["ntp", "which", "tar", "zip", "unzip", "bzip2", "sysstat", "autoconf", "automake", "libtool", "bison"].each do |pkg| if (node.platform == "centos" && node.platform_version == "5.8") && ( pkg == "git" || pkg == "git-core" ) Chef::Log.info("no git package on centos 5.8") elsif (node.platform == "suse" || node.platform == "ubuntu") && pkg == "which" Chef::Log.info("no which package on suse") elsif node.platform == "suse" && pkg == "nc" pkg = "netcat-openbsd" else package pkg do action :install end end end case node.platform when "ubuntu" ["ca-certificates","python-software-properties"].each do |pkg| package pkg do action :install end end when "suse" ["bind-utils","openssl"].each do |pkg| package pkg do action :install end end else # redhat based nc = "nc" if node.platform_version.to_i >= 7 nc = "nmap-ncat" end ["bind-utils","openssl",nc].each do |pkg| package pkg do action :install end end end
21.117647
81
0.579387
28cf6613e372b9203fe30c3b4689e1dcd8e1f833
449
# frozen_string_literal: true Puppet::Type.newtype(:elasticsearch_user_roles) do desc 'Type to model Elasticsearch user roles.' ensurable newparam(:name, namevar: true) do desc 'User name.' end newproperty(:roles, array_matching: :all) do desc 'Array of roles that the user should belong to.' def insync?(value) value.sort == should.sort end end autorequire(:elasticsearch_user) do self[:name] end end
19.521739
57
0.699332
5df1db780b8d25055dcb2d0c5585eccd47367de9
22,068
require 'test_helper' class PersonTest < ActiveSupport::TestCase fixtures :users, :people # Replace this with your real tests. def test_work_groups p=Factory(:person_in_multiple_projects) assert_equal 3,p.work_groups.size end def test_can_be_edited_by? admin = Factory(:admin) project_manager = Factory(:project_manager) project_manager2 = Factory(:project_manager) person = Factory :person,:group_memberships=>[Factory(:group_membership,:work_group=>project_manager.group_memberships.first.work_group)] another_person = Factory :person assert_equal person.projects,project_manager.projects assert_not_equal person.projects,project_manager2.projects assert person.can_be_edited_by?(person.user) assert person.can_be_edited_by?(project_manager.user),"should be editable by the project manager of the same project" assert person.can_be_edited_by?(admin.user) assert !person.can_be_edited_by?(another_person.user) assert !person.can_be_edited_by?(project_manager2.user),"should be not editable by the project manager of another project" assert person.can_be_edited_by?(person), "You can also ask by passing in a person" assert person.can_be_edited_by?(project_manager),"You can also ask by passing in a person" end test "programmes" do person1=Factory(:person) prog = Factory(:programme,:projects=>person1.projects) prog2 = Factory(:programme) assert_includes person1.programmes,prog refute_includes person1.programmes,prog2 end test "can be administered by" do admin = Factory(:admin) admin2 = Factory(:admin) project_manager = Factory(:project_manager) person_in_same_project = Factory :person,:group_memberships=>[Factory(:group_membership,:work_group=>project_manager.group_memberships.first.work_group)] person_in_different_project = Factory :person assert admin.can_be_administered_by?(admin.user),"admin can administer themself" assert admin2.can_be_administered_by?(admin.user),"admin can administer another admin" assert project_manager.can_be_administered_by?(admin.user),"admin should be able to administer another project manager" assert person_in_same_project.can_be_administered_by?(project_manager.user),"project manager should be able to administer someone from same project" assert person_in_different_project.can_be_administered_by?(project_manager.user),"project manager should be able to administer someone from another project" assert !project_manager.can_be_administered_by?(person_in_same_project.user),"a normal person cannot administer someone else" assert !project_manager.can_be_administered_by?(project_manager.user),"project manager should not administer himself" assert !person_in_same_project.can_be_administered_by?(person_in_same_project.user), "person should not administer themself" assert !person_in_same_project.can_be_administered_by?(nil) assert project_manager.can_be_administered_by?(admin),"you can also ask by passing a person" assert person_in_same_project.can_be_administered_by?(project_manager),"you can also ask by passing a person" end test "project manager cannot edit an admin within their project" do admin = Factory(:admin) project_manager = Factory(:project_manager,:group_memberships=>[Factory(:group_membership,:work_group=>admin.group_memberships.first.work_group)]) assert !(admin.projects & project_manager.projects).empty? assert !admin.can_be_edited_by?(project_manager) end #checks the updated_at doesn't get artificially changed between created and reloading def test_updated_at person = Factory(:person, :updated_at=>1.week.ago) updated_at = person.updated_at person = Person.find(person.id) assert_equal updated_at.to_s,person.updated_at.to_s end test "to_rdf" do object = Factory :person, :skype_name=>"skypee",:email=>"[email protected]" Factory(:study,:contributor=>object) Factory(:investigation,:contributor=>object) Factory(:assay,:contributor=>object) Factory(:assay,:contributor=>object) Factory(:assets_creator,:creator=>object) Factory(:assets_creator,:asset=>Factory(:sop),:creator=>object) object.web_page="http://google.com" disable_authorization_checks do object.save! end object.reload rdf = object.to_rdf RDF::Reader.for(:rdfxml).new(rdf) do |reader| assert reader.statements.count > 1 assert_equal RDF::URI.new("http://localhost:3000/people/#{object.id}"), reader.statements.first.subject assert reader.has_triple? ["http://localhost:3000/people/#{object.id}",RDF::FOAF.mbox_sha1sum,"b507549e01d249ee5ed98bd40e4d86d1470a13b8"] end end test "orcid id validation" do p = Factory :person p.orcid = nil assert p.valid? p.orcid = "sdff-1111-1111-1111" assert !p.valid? p.orcid = "1111111111111111" assert !p.valid? p.orcid = "0000-0002-1694-2339" assert !p.valid?,"checksum doesn't match" p.orcid = "0000-0002-1694-233X" assert p.valid? p.orcid = "http://orcid.org/0000-0002-1694-233X" assert p.valid? p.orcid = "http://orcid.org/0000-0003-2130-0865" assert p.valid? end test "email uri" do p = Factory :person, :email=>"sfkh^[email protected]" assert_equal "mailto:sfkh%[email protected]",p.email_uri end test "only first admin person" do Person.delete_all person = Factory :admin assert person.only_first_admin_person? person.is_admin=false disable_authorization_checks{person.save!} assert !person.only_first_admin_person? person.is_admin=true disable_authorization_checks{person.save!} assert person.only_first_admin_person? Factory :person assert !person.only_first_admin_person? end def test_active_ordered_by_updated_at_and_avatar_not_null Person.delete_all avatar = Factory :avatar people = [] people << Factory(:person,:avatar=>avatar, :updated_at=>1.week.ago) people << Factory(:person,:avatar=>avatar, :updated_at=>1.minute.ago) people << Factory(:person,:updated_at=>1.day.ago) people << Factory(:person,:updated_at=>1.hour.ago) people << Factory(:person,:updated_at=>2.minutes.ago) sorted = Person.all.sort do |x,y| if x.avatar.nil? == y.avatar.nil? y.updated_at <=> x.updated_at else if x.avatar.nil? 1 else -1 end end end assert_equal sorted, Person.active end def test_ordered_by_last_name sorted = Person.find(:all).sort_by do |p| lname = "" || p.last_name.try(:downcase) fname = "" || p.first_name.try(:downcase) lname+fname end assert_equal sorted, Person.find(:all) end def test_is_asset assert !Person.is_asset? assert !people(:quentin_person).is_asset? assert !people(:quentin_person).is_downloadable_asset? end def test_member_of p=Factory :person proj = Factory :project assert !p.projects.empty? assert p.member_of?(p.projects.first) assert !p.member_of?(proj) end def test_avatar_key p=people(:quentin_person) assert_nil p.avatar_key assert p.defines_own_avatar? end def test_first_person_is_admin assert Person.count>0 #should already be people from fixtures p=Person.new(:first_name=>"XXX",:email=>"[email protected]") p.save! assert !p.is_admin?, "Should not automatically be admin, since people already exist" Person.delete_all assert_equal 0,Person.count #no people should exist p=Person.new(:first_name=>"XXX",:email=>"[email protected]") p.save p.reload assert p.is_admin?, "Should automatically be admin, since it is the first created person" end def test_registered registered=Person.registered registered.each do |p| assert_not_nil p.user end assert registered.include?(people(:quentin_person)) assert !registered.include?(people(:person_without_user)) end def test_duplicates dups=Person.duplicates assert !dups.empty? assert dups.include?(people(:duplicate_1)) assert dups.include?(people(:duplicate_2)) end test "without group" do no_group = Factory(:brand_new_person) in_group = Factory(:person) assert no_group.projects.empty? assert !in_group.projects.empty? all = Person.without_group assert !all.include?(in_group) assert all.include?(no_group) end test "with group" do no_group = Factory(:brand_new_person) in_group = Factory(:person) assert no_group.projects.empty? assert !in_group.projects.empty? all = Person.with_group assert all.include?(in_group) assert !all.include?(no_group) end def test_expertise p=Factory :person Factory :expertise,:value=>"golf",:annotatable=>p Factory :expertise,:value=>"fishing",:annotatable=>p Factory :tool,:value=>"sbml",:annotatable=>p assert_equal 2, p.expertise.size p=Factory :person Factory :expertise,:value=>"golf",:annotatable=>p Factory :tool,:value=>"sbml",:annotatable=>p assert_equal 1, p.expertise.size assert_equal "golf",p.expertise[0].text end def test_tools p=Factory :person Factory :tool,:value=>"sbml",:annotatable=>p Factory :tool,:value=>"java",:annotatable=>p Factory :expertise,:value=>"sbml",:annotatable=>p assert_equal 2, p.tools.size p=Factory :person Factory :tool,:value=>"sbml",:annotatable=>p Factory :expertise,:value=>"fishing",:annotatable=>p assert_equal 1, p.tools.size assert_equal "sbml",p.tools[0].text end def test_assign_expertise p=Factory :person User.with_current_user p.user do assert_equal 0,p.expertise.size assert_difference("Annotation.count",2) do assert_difference("TextValue.count",2) do p.expertise = ["golf","fishing"] end end assert_equal 2,p.expertise.size assert p.expertise.collect{|e| e.text}.include?("golf") assert p.expertise.collect{|e| e.text}.include?("fishing") assert_difference("Annotation.count",-1) do assert_no_difference("TextValue.count") do p.expertise = ["golf"] end end assert_equal 1,p.expertise.size assert_equal "golf",p.expertise[0].text p2=Factory :person assert_difference("Annotation.count") do assert_no_difference("TextValue.count") do p2.expertise = ["golf"] end end end end def test_assigns_tools p=Factory :person User.with_current_user p.user do assert_equal 0,p.tools.size assert_difference("Annotation.count",2) do assert_difference("TextValue.count",2) do p.tools = ["golf","fishing"] end end assert_equal 2,p.tools.size assert p.tools.collect{|e| e.text}.include?("golf") assert p.tools.collect{|e| e.text}.include?("fishing") assert_difference("Annotation.count",-1) do assert_no_difference("TextValue.count") do p.tools = ["golf"] end end assert_equal 1,p.tools.size assert_equal "golf",p.tools[0].text p2=Factory :person assert_difference("Annotation.count") do assert_no_difference("TextValue.count") do p2.tools = ["golf"] end end end end def test_removes_previously_assigned p=Factory :person User.with_current_user p.user do p.tools = ["one","two"] assert_equal 2,p.tools.size p.tools = ["three"] assert_equal 1,p.tools.size assert_equal "three",p.tools[0].text p=Factory :person p.expertise = ["aaa","bbb"] assert_equal 2,p.expertise.size p.expertise = ["ccc"] assert_equal 1,p.expertise.size assert_equal "ccc",p.expertise[0].text end end def test_expertise_and_tools_with_same_name p=Factory :person User.with_current_user p.user do assert_difference("Annotation.count",2) do assert_difference("TextValue.count",2) do p.tools = ["golf","fishing"] end end assert_difference("Annotation.count",2) do assert_no_difference("TextValue.count") do p.expertise = ["golf","fishing"] end end end end def test_institutions person = Factory(:person_in_multiple_projects) institution = person.group_memberships.first.work_group.institution institution2 = Factory(:institution) assert_equal 3,person.institutions.count assert person.institutions.include?(institution) assert !person.institutions.include?(institution2) end def test_projects p=Factory(:person_in_multiple_projects) assert_equal 3,p.projects.size end def test_userless_people peeps=Person.userless_people assert_not_nil peeps assert peeps.size>0,"There should be some userless people" assert_nil(peeps.find{|p| !p.user.nil?},"There should be no people with a non nil user") p=people(:three) assert_not_nil(peeps.find{|person| p.id==person.id},"Person :three should be userless and therefore in the list") p=people(:quentin_person) assert_nil(peeps.find{|person| p.id==person.id},"Person :one should have a user and not be in the list") end def test_name p=people(:quentin_person) assert_equal "Quentin Jones", p.name p.first_name="Tom" assert_equal "Tom Jones", p.name end def test_email_with_name p=people(:quentin_person) assert_equal("Quentin Jones <[email protected]>",p.email_with_name) end def test_email_with_name_no_last_name p=Person.new(:first_name=>"Fred",:email=>"[email protected]") assert_equal("Fred <[email protected]>",p.email_with_name) end def test_capitalization_with_nil_last_name p=people(:no_first_name) assert_equal "Lastname",p.name end def test_capitalization_with_nil_first_name p=people(:no_last_name) assert_equal "Firstname",p.name end def test_double_firstname_capitalised p=people(:double_firstname) assert_equal "Fred David Bloggs", p.name end def test_double_lastname_capitalised p=people(:double_lastname) assert_equal "Fred Smith Jones",p.name end def test_double_barrelled_lastname_capitalised p=people(:double_barrelled_lastname) assert_equal "Fred Smith-Jones",p.name end def test_valid p=people(:quentin_person) assert p.valid? p.email=nil assert !p.valid? p.email="sdf" assert !p.valid? p.email="sdf@" assert !p.valid? p.email="[email protected]" assert p.valid? p.web_page=nil assert p.valid? p.web_page="" assert p.valid? p.web_page="sdfsdf" assert !p.valid? p.web_page="http://google.com" assert p.valid? p.web_page="https://google.com" assert p.valid? p.web_page="http://google.com/fred" assert p.valid? p.web_page="http://google.com/fred?param=bob" assert p.valid? p.web_page="http://www.mygrid.org.uk/dev/issues/secure/IssueNavigator.jspa?reset=true&mode=hide&sorter/order=DESC&sorter/field=priority&resolution=-1&pid=10051&fixfor=10110" assert p.valid? end def test_email_with_capitalise_valid p=people(:quentin_person) assert p.valid? p.email="[email protected]" assert p.valid? p.email="[email protected]" assert p.valid?,"Capitals in email should be valid" end def test_email_unique p=people(:quentin_person) newP=Person.new(:first_name=>"Fred",:email=>p.email) assert !newP.valid?,"Should not be valid as email is not unique" newP.email = p.email.capitalize assert !newP.valid?,"Should not be valid as email is not case sensitive" newP.email="[email protected]" assert newP.valid? end def test_disciplines p = Factory :person,:disciplines=>[Factory(:discipline,:title=>"A"),Factory(:discipline, :title=>"B")] p.reload assert_equal 2,p.disciplines.size assert_equal "A",p.disciplines[0].title assert_equal "B",p.disciplines[1].title end def test_roles_association role = Factory(:project_role) p=Factory :person p.group_memberships.first.project_roles << role assert_equal 1, p.project_roles.size assert p.project_roles.include?(role) end def test_update_first_letter p=Person.new(:first_name=>"Fred",:last_name=>"Monkhouse",:email=>"[email protected]") assert p.valid?,"The new person should be valid" p.save assert_equal "M",p.first_letter p=Person.new(:first_name=>"Freddy",:email=>"[email protected]") assert p.valid?,"The new person should be valid" p.save assert_equal "F",p.first_letter p=Person.new(:first_name=>"Zebedee",:email=>"[email protected]") assert p.valid?,"The new person should be valid" p.save assert_equal "Z",p.first_letter end def test_update_first_letter_blank_last_name p=Person.new(:first_name=>"Zebedee",:last_name=>"",:email=>"[email protected]") assert p.valid?,"The new person should be valid" p.save assert_equal "Z",p.first_letter end def test_notifiee_info_inserted p=Person.new(:first_name=>"Zebedee",:last_name=>"",:email=>"[email protected]") assert_nil p.notifiee_info assert_difference("NotifieeInfo.count") do p.save! end p=Person.find(p.id) assert_not_nil p.notifiee_info assert p.receive_notifications? end def test_dependent_notifiee_info_is_destroyed_with_person p=Person.new(:first_name=>"Zebedee",:last_name=>"",:email=>"[email protected]") p.save! assert_not_nil p.notifiee_info assert_difference("NotifieeInfo.count",-1) do p.destroy end end def test_user_is_destroyed_with_person p=people(:quentin_person) u=users(:quentin) assert_difference("Person.count",-1) do assert_difference("User.count",-1) do p.destroy end end assert_nil User.find_by_id(u.id) p=people(:random_userless_person) assert_difference("Person.count",-1) do assert_no_difference("User.count") do p.destroy end end end def test_updated_not_changed_when_adding_notifiee_info p=people(:modeller_person) up_at=p.updated_at sleep(2) p.check_for_notifiee_info assert_equal up_at,p.updated_at end test "test uuid generated" do p = people(:modeller_person) assert_nil p.attributes["uuid"] p.save assert_not_nil p.attributes["uuid"] end test "uuid doesn't change" do x = people(:modeller_person) x.save uuid = x.attributes["uuid"] x.save assert_equal x.uuid, uuid end test 'projects method notices changes via both group_memberships and work_groups' do person = Factory.build(:person, :group_memberships => [Factory(:group_membership)]) group_membership_projects = person.group_memberships.map(&:work_group).map(&:project).uniq.sort_by(&:title) work_group_projects = person.work_groups.map(&:project).uniq.sort_by(&:title) assert_equal (group_membership_projects | work_group_projects), person.projects.sort_by(&:title) end test 'should retrieve the list of people who have the manage right on the item' do user = Factory(:user) person = user.person data_file = Factory(:data_file, :contributor => user) people_can_manage = data_file.people_can_manage assert_equal 1, people_can_manage.count assert_equal person.id, people_can_manage.first[0] new_person = Factory(:person_in_project) policy = data_file.policy policy.permissions.build(:contributor => new_person, :access_type => Policy::MANAGING) policy.save people_can_manage = data_file.people_can_manage assert_equal 2, people_can_manage.count people_ids = people_can_manage.collect{|p| p[0]} assert people_ids.include? person.id assert people_ids.include? new_person.id end test "related resource" do user = Factory :user person = user.person User.with_current_user(user) do AssetsCreator.create :asset=>Factory(:data_file),:creator=> person AssetsCreator.create :asset=>Factory(:model),:creator=> person AssetsCreator.create :asset=>Factory(:sop),:creator=> person Factory :event,:contributor=>user AssetsCreator.create :asset=>Factory(:presentation),:creator=> person AssetsCreator.create :asset=>Factory(:publication),:creator=>person assert_equal person.created_data_files, person.related_data_files assert_equal person.created_models, person.related_models assert_equal person.created_sops, person.related_sops assert_equal user.events, person.related_events assert_equal person.created_presentations, person.related_presentations assert_equal person.created_publications, person.related_publications end end test "get the correct investigations and studides" do p = Factory(:person) u = p.user inv1 = Factory(:investigation, :contributor=>p) inv2 = Factory(:investigation, :contributor=>u) study1 = Factory(:study, :contributor=>p) study2 = Factory(:study, :contributor=>u) p = Person.find(p.id) assert_equal [study1,study2],p.studies.sort_by(&:id) assert_equal [inv1,inv2],p.investigations.sort_by(&:id) end test "can_create_new_items" do p=Factory :person assert p.can_create_new_items? assert p.member? p.group_memberships.destroy_all #this is necessary because Person caches the projects in the instance variable @known_projects p = Person.find(p.id) assert !p.member? assert !p.can_create_new_items? end test "should be able to remove the workgroup whose project is not subcribed" do p=Factory :person wg = Factory :work_group p.work_groups = [wg] p.project_subscriptions.delete_all assert p.project_subscriptions.empty? p.work_groups = [] p.save assert_empty p.work_groups assert_empty p.projects end end
30.907563
177
0.704368
874f2661a9b2190ad4ebdb19bc1944cdbc8b5eb5
2,144
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::EventGrid::Mgmt::V2019_02_01_preview module Models # # Information about the webhook destination for an event subscription # class WebHookEventSubscriptionDestination < EventSubscriptionDestination include MsRestAzure def initialize @endpointType = "WebHook" end attr_accessor :endpointType # @return [String] The URL that represents the endpoint of the # destination of an event subscription. attr_accessor :endpoint_url # @return [String] The base URL that represents the endpoint of the # destination of an event subscription. attr_accessor :endpoint_base_url # # Mapper for WebHookEventSubscriptionDestination class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'WebHook', type: { name: 'Composite', class_name: 'WebHookEventSubscriptionDestination', model_properties: { endpointType: { client_side_validation: true, required: true, serialized_name: 'endpointType', type: { name: 'String' } }, endpoint_url: { client_side_validation: true, required: false, serialized_name: 'properties.endpointUrl', type: { name: 'String' } }, endpoint_base_url: { client_side_validation: true, required: false, read_only: true, serialized_name: 'properties.endpointBaseUrl', type: { name: 'String' } } } } } end end end end
28.210526
76
0.553638
4a852501741556c8dc5f6b4dda0ff1b40766fbe4
2,303
# -*- encoding: utf-8 -*- # stub: rake 12.3.3 ruby lib Gem::Specification.new do |s| s.name = "rake".freeze s.version = "12.3.3" s.required_rubygems_version = Gem::Requirement.new(">= 1.3.2".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Hiroshi SHIBATA".freeze, "Eric Hodel".freeze, "Jim Weirich".freeze] s.bindir = "exe".freeze s.date = "2019-07-22" s.description = "Rake is a Make-like program implemented in Ruby. Tasks and dependencies are\nspecified in standard Ruby syntax.\nRake has the following features:\n * Rakefiles (rake's version of Makefiles) are completely defined in standard Ruby syntax.\n No XML files to edit. No quirky Makefile syntax to worry about (is that a tab or a space?)\n * Users can specify tasks with prerequisites.\n * Rake supports rule patterns to synthesize implicit tasks.\n * Flexible FileLists that act like arrays but know about manipulating file names and paths.\n * Supports parallel execution of tasks.\n".freeze s.email = ["[email protected]".freeze, "[email protected]".freeze, "".freeze] s.executables = ["rake".freeze] s.files = ["exe/rake".freeze] s.homepage = "https://github.com/ruby/rake".freeze s.licenses = ["MIT".freeze] s.rdoc_options = ["--main".freeze, "README.rdoc".freeze] s.required_ruby_version = Gem::Requirement.new(">= 2.0.0".freeze) s.rubygems_version = "3.2.13".freeze s.summary = "Rake is a Make-like program implemented in Ruby".freeze s.installed_by_version = "3.2.13" if s.respond_to? :installed_by_version if s.respond_to? :specification_version then s.specification_version = 4 end if s.respond_to? :add_runtime_dependency then s.add_development_dependency(%q<bundler>.freeze, [">= 0"]) s.add_development_dependency(%q<minitest>.freeze, [">= 0"]) s.add_development_dependency(%q<rdoc>.freeze, [">= 0"]) s.add_development_dependency(%q<coveralls>.freeze, [">= 0"]) s.add_development_dependency(%q<rubocop>.freeze, [">= 0"]) else s.add_dependency(%q<bundler>.freeze, [">= 0"]) s.add_dependency(%q<minitest>.freeze, [">= 0"]) s.add_dependency(%q<rdoc>.freeze, [">= 0"]) s.add_dependency(%q<coveralls>.freeze, [">= 0"]) s.add_dependency(%q<rubocop>.freeze, [">= 0"]) end end
52.340909
613
0.699088
6214aa565af8323bf8f407bd358579711430c45d
500
class Rfc < Formula desc "Bash tool to read RFCs from the command-line" homepage "https://github.com/bfontaine/rfc#readme" url "https://github.com/bfontaine/rfc/archive/v0.2.6.tar.gz" sha256 "724c47827ff1009359919a6fbdc9bb73d35c553546173f65058febca722f9931" head "https://github.com/bfontaine/rfc.git" def install bin.install "rfc" man1.install "man/rfc.1" end test do ENV["PAGER"] = "cat" assert_match "Message Data Types", shell_output("#{bin}/rfc 42") end end
26.315789
75
0.716
21490f993c7fcfe127f7c61cc1dd9d2164553669
3,617
# frozen_string_literal: true require 'spec_helper' RSpec.describe Security::CiConfiguration::SastParserService do describe '#configuration' do include_context 'read ci configuration for sast enabled project' let(:configuration) { described_class.new(project).configuration } let(:secure_analyzers_prefix) { configuration['global'][0] } let(:sast_excluded_paths) { configuration['global'][1] } let(:sast_analyzer_image_tag) { configuration['global'][2] } let(:sast_pipeline_stage) { configuration['pipeline'][0] } let(:sast_search_max_depth) { configuration['pipeline'][1] } let(:brakeman) { configuration['analyzers'][0] } let(:bandit) { configuration['analyzers'][1] } let(:sast_brakeman_level) { brakeman['variables'][0] } it 'parses the configuration for SAST' do expect(secure_analyzers_prefix['default_value']).to eql('registry.gitlab.com/gitlab-org/security-products/analyzers') expect(sast_excluded_paths['default_value']).to eql('spec, test, tests, tmp') expect(sast_analyzer_image_tag['default_value']).to eql('2') expect(sast_pipeline_stage['default_value']).to eql('test') expect(sast_search_max_depth['default_value']).to eql('4') expect(brakeman['enabled']).to be(true) expect(sast_brakeman_level['default_value']).to eql('1') end context 'while populating current values of the entities' do context 'when .gitlab-ci.yml is present' do it 'populates the current values from the file' do allow(project.repository).to receive(:blob_data_at).and_return(gitlab_ci_yml_content) expect(secure_analyzers_prefix['value']).to eql('registry.gitlab.com/gitlab-org/security-products/analyzers2') expect(sast_excluded_paths['value']).to eql('spec, executables') expect(sast_analyzer_image_tag['value']).to eql('2') expect(sast_pipeline_stage['value']).to eql('our_custom_security_stage') expect(sast_search_max_depth['value']).to eql('8') expect(brakeman['enabled']).to be(false) expect(bandit['enabled']).to be(true) expect(sast_brakeman_level['value']).to eql('2') end context 'SAST_DEFAULT_ANALYZERS is set' do it 'enables analyzers correctly' do allow(project.repository).to receive(:blob_data_at).and_return(gitlab_ci_yml_default_analyzers_content) expect(brakeman['enabled']).to be(false) expect(bandit['enabled']).to be(true) end end context 'SAST_EXCLUDED_ANALYZERS is set' do it 'enables analyzers correctly' do allow(project.repository).to receive(:blob_data_at).and_return(gitlab_ci_yml_excluded_analyzers_content) expect(brakeman['enabled']).to be(false) expect(bandit['enabled']).to be(true) end end end context 'when .gitlab-ci.yml is absent' do it 'populates the current values with the default values' do allow(project.repository).to receive(:blob_data_at).and_return(nil) expect(secure_analyzers_prefix['value']).to eql('registry.gitlab.com/gitlab-org/security-products/analyzers') expect(sast_excluded_paths['value']).to eql('spec, test, tests, tmp') expect(sast_analyzer_image_tag['value']).to eql('2') expect(sast_pipeline_stage['value']).to eql('test') expect(sast_search_max_depth['value']).to eql('4') expect(brakeman['enabled']).to be(true) expect(sast_brakeman_level['value']).to eql('1') end end end end end
46.974026
123
0.679845
7a707a39bfa3c29dfc3ee474897efb1b3117a638
216
require 'airbrake/sidekiq' warn "DEPRECATION WARNING: Requiring 'airbrake/sidekiq/error_handler' is " \ "deprecated and will be removed in the next MAJOR release. Require " \ "'airbrake/sidekiq' instead."
36
76
0.736111
e23fe7c03503651a932dc83bca093c9531a46453
1,492
# frozen_string_literal: true # WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE require 'aws-sdk-core' require 'aws-sigv4' require_relative 'aws-sdk-personalizeevents/types' require_relative 'aws-sdk-personalizeevents/client_api' require_relative 'aws-sdk-personalizeevents/client' require_relative 'aws-sdk-personalizeevents/errors' require_relative 'aws-sdk-personalizeevents/resource' require_relative 'aws-sdk-personalizeevents/customizations' # This module provides support for Amazon Personalize Events. This module is available in the # `aws-sdk-personalizeevents` gem. # # # Client # # The {Client} class provides one method for each API operation. Operation # methods each accept a hash of request parameters and return a response # structure. # # personalize_events = Aws::PersonalizeEvents::Client.new # resp = personalize_events.put_events(params) # # See {Client} for more information. # # # Errors # # Errors returned from Amazon Personalize Events are defined in the # {Errors} module and all extend {Errors::ServiceError}. # # begin # # do stuff # rescue Aws::PersonalizeEvents::Errors::ServiceError # # rescues all Amazon Personalize Events API errors # end # # See {Errors} for more information. # # @!group service module Aws::PersonalizeEvents GEM_VERSION = '1.18.0' end
27.62963
93
0.763405
26ba5a53f7b48a3b4cc212df611170c87b97e556
663
Pod::Spec.new do |s| s.name = "RNZeroconf" s.version = "1.0.0" s.summary = "RNZeroconf" s.description = "A Zeroconf discovery utility for react-native" s.homepage = "https://github.com/balthazar/react-native-zeroconf" s.license = "MIT" # s.license = { :type => "MIT", :file => "FILE_LICENSE" } s.author = { "author" => "[email protected]" } s.platform = :ios, "7.0" s.source = { :git => "https://github.com/balthazar/react-native-zeroconf.git", :tag => "master" } s.source_files = "RNZeroconf/**/*.{h,m}" s.requires_arc = true s.dependency "React" #s.dependency "others" end
30.136364
105
0.579186
6a7153241cf6260672e063f800bc4e26c8740cff
4,413
# Copyright © 2011-2019 MUSC Foundation for Research Development # All rights reserved. # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided with the distribution. # 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products # derived from this software without specific prior written permission. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT # SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require 'rails_helper' RSpec.describe 'User edits Organization Pricing', js: true do let_there_be_lane fake_login_for_each_test before :each do @institution = create(:institution) @provider = create(:provider, :with_subsidy_map, parent_id: @institution.id) @catalog_manager = create(:catalog_manager, organization_id: @institution.id, identity_id: Identity.where(ldap_uid: 'jug2').first.id, edit_historic_data: true) create(:pricing_setup, organization: @provider, display_date: Date.today - 1, effective_date: Date.today - 1) end context 'on a Provider' do context 'and the user edits the pricing setup dates and source' do before :each do visit catalog_manager_catalog_index_path wait_for_javascript_to_finish find("#institution-#{@institution.id}").click wait_for_javascript_to_finish click_link @provider.name wait_for_javascript_to_finish click_link 'Pricing' wait_for_javascript_to_finish end it 'should edit the display date and effective date' do find(".edit_pricing_setup_link").click wait_for_javascript_to_finish bootstrap3_datepicker('#pricing_setup_display_date') bootstrap3_datepicker('#pricing_setup_effective_date') click_button 'Save' wait_for_javascript_to_finish @provider.reload expect(@provider.pricing_setups.first.display_date).to eq(Date.today) expect(@provider.pricing_setups.first.effective_date).to eq(Date.today) end it 'should throw error if the effective date is after display date' do find(".edit_pricing_setup_link").click wait_for_javascript_to_finish bootstrap3_datepicker('#pricing_setup_display_date') click_button 'Save' wait_for_javascript_to_finish expect(page).to have_content('Effective date must be the same, or later than display date.') end it 'should edit the source of price' do find(".edit_pricing_setup_link").click wait_for_javascript_to_finish first('.modal-body div.toggle.btn').click click_button 'Save' wait_for_javascript_to_finish @provider.reload expect(@provider.pricing_setups.first.charge_master).to eq(true) end it 'should disable display date, effective date and source of price if the catalog manager cannot edit historic data' do @catalog_manager.update_attributes(edit_historic_data: false) find(".edit_pricing_setup_link").click wait_for_javascript_to_finish expect(find('#pricing_setup_display_date')).to be_disabled expect(find('#pricing_setup_effective_date')).to be_disabled expect(page).to have_selector('[name="pricing_setup[charge_master]"] + .toggle[disabled=disabled]') end end end end
45.030612
163
0.744845
ff36a9d82c0f49256dc2e9f638a431c75fcadb4d
422
module SignInHelpers def sign_in(user) visit '/admin/users/sign_in' fill_in 'Email', :with => user.email fill_in 'Password', :with => 'password' click_button 'Sign in' page.should have_content("Du er nu logget ind.") end def sign_out click_link 'Sign out' page.should have_content("Du er nu logget ud.") end end RSpec.configure do |c| c.include SignInHelpers, :type => :request end
22.210526
52
0.680095
ede39a23d3df6dbd8228a4708e1f018baea33210
168
class AddAncestryToMicroposts < ActiveRecord::Migration[5.0] def change add_column :microposts, :ancestry, :string add_index :microposts, :ancestry end end
24
60
0.755952
b9f32eb8a110337a7621cdd7c58e6fb75dee3a3c
243
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. module Azure end module Azure::Serialconsole end module Azure::Serialconsole::Mgmt end
34.714286
94
0.802469
6135e308d63459f37f9e57d8da5407ebe73dd057
1,320
# frozen_string_literal: true module Codebreaker module Validation def check_user_name(name) check_type(name, String) check_name_length(name) end def check_guess_code(code) check_code_length(code) check_code_value(code) end def check_type(object, expected_class) raise Errors::CheckTypeError unless object.is_a?(expected_class) end def check_name_length(name) raise Errors::CheckNameLengthError unless name.length.between?(Codebreaker::Constant::MIN_NAME_LENGTH, Codebreaker::Constant::MAX_NAME_LENGTH) end def check_code_length(guess) raise Errors::CheckCodeLengthError unless guess.to_s.length == Codebreaker::Constant::CODE_SIZE end def check_code_value(guess) raise Errors::CheckCodeValueError unless guess.to_s.chars.all? do |number| number.to_i >= Codebreaker::Constant::MIN_CODE_VALUE && number.to_i <= Codebreaker::Constant::MAX_CODE_VALUE end end def check_difficulty(difficulty) raise Errors::CheckDifficultyError unless Difficulty::DIFFICULTIES.key?(difficulty) end end end
33
108
0.625758
622852cc44275ef411211a6d89296b058f37a813
2,130
module Powertools::HistoryTracker extend ActiveSupport::Concern included do if defined? self.has_many attr_accessor :pt_changes has_many :histories, as: :associated, class_name: 'PtHistory' has_many :histories_without_scope, as: :trackable, class_name: 'PtHistory' after_update :set_pt_changes end end def set_pt_changes if self.changed? ignore_list = %w(created_at updated_at deleted_at updater_id creator_id) self.pt_changes = changes.reject { |key, value| ignore_list.include? key } else false end end def pt_track_history(trackable, current_user, permission, options = {}) # So we can access it via a string or symbol options = options.with_indifferent_access # Set the current action action = options.key?(:action) ? options[:action] : params[:action] # Go no further if we don't have updates return if (action == 'update' and not trackable.pt_changes and not options[:force_save]) if (options[:action_type].present? and options[:action_type].to_sym == :viewed) cache_key = "viewed_claim_#{trackable.id}_#{current_user.id}" return if Rails.cache.exist? cache_key Rails.cache.write cache_key, true, expires_in: 300 end # Create the new history line history = PtHistory.new action: action history.creator = current_user history.permission = permission history.action = action history.action_type = options.key?(:action_type) ? options[:action_type].to_s : nil history.action_subtype = options.key?(:action_subtype) ? options[:action_subtype].to_s : nil history.trackable = trackable history.associated = options.key?(:scope) ? options[:scope] : trackable if action == 'update' history.trackable_changes = trackable.pt_changes ? trackable.pt_changes.to_json : nil end # Save any extra options if options.key? :extras raise "extras must be a hash" if !options[:extras].is_a? Hash history.extras = options[:extras].to_json end # Save the history history.save! end unless defined? self.has_many end
32.769231
97
0.700939
331ea8d135d46ffa414f05210675f3837f9e8545
436
require ('sinatra') require ('sinatra/reloader') require('./lib/stylist') require('./lib/client') require('pg') also_reload('lib/**/*.rb') get('/') do @stylists = Stylist.all() erb(:index) end # get('/stylist') do # @stylists = Stylist.all() # erb(:stylist) # end post('/new_stylist') do name = params.fetch('new_stylist') new_stylist = Stylist.new({:name => name, :id => nil}) new_stylist.save() redirect('/') end
16.769231
56
0.62844
33f4aa67de0b6118b7a255368a16b27de0bd9a2d
379
module LifxFaraday class Light include Api::Connection.new LifxFaraday::API def initialize(selector: 'all') @selector = selector end def set_state(state_options) raise 'needs a selector' unless selector && selector.to_s != '' connection.put "lights/#{selector}/state", state_options end private attr_reader :selector end end
19.947368
69
0.6781
62231c2361a8653dd99dbc6827833a3e29021ac5
1,254
class E2fsprogs < Formula desc "Utilities for the ext2, ext3, and ext4 file systems" homepage "https://e2fsprogs.sourceforge.io/" url "https://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.44.3/e2fsprogs-1.44.3.tar.gz" sha256 "c2ae6d8ce6fb96b55886cf761411fc22ab41976f4f8297fc54c706df442483be" head "https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git" bottle do sha256 "b7daa8ca1c002746acf36634291eaa5235333477799745b95fe33c5d4f780fc4" => :high_sierra sha256 "7adfb15de137e432cc89e4baf97778fb86a0ef3a5df8b9c7103990cfb5e51bb1" => :sierra sha256 "2c773cea28459ddd2a0387f45a089a5d0c40d7b10bf1c796c0f29c0df7c6800d" => :el_capitan sha256 "d790c9294c276c4f7bb4b51ca55c189d5cb7dc72ddd5a31985dd9acb9ba0738e" => :x86_64_linux end keg_only "this installs several executables which shadow macOS system commands" depends_on "pkg-config" => :build depends_on "gettext" def install system "./configure", "--prefix=#{prefix}", "--disable-e2initrd-helper", *("--enable-elf-shlibs" unless OS.mac?) system "make" system "make", "install" system "make", "install-libs" end test do assert_equal 36, shell_output("#{bin}/uuidgen").strip.length system bin/"lsattr", "-al" end end
38
101
0.753589
114d4af49215168722bec4a39a6ef6e4823499ea
802
Given /^the following manage_searches:$/ do |manage_searches| ManageSearch.create!(manage_searches.hashes) end When /^I delete the (\d+)(?:st|nd|rd|th) manage_search$/ do |pos| visit manage_searches_path within("table tr:nth-child(#{pos.to_i+1})") do click_link "Destroy" end end Given /^I redirect to the search path$/ do visit search_stores_path end Given /^the page should contain the result of my search video$/ do visit search_stores_path Then %{I am on the the search path } text="video" if page.respond_to? :should page.should have_content(text) else assert page.has_content?(text) end end Then /^I should see the following manage_searches:$/ do |expected_manage_searches_table| expected_manage_searches_table.diff!(tableish('table tr', 'td,th')) end
25.0625
88
0.733167
28e265dbf574d74a8918cfb0b3f111f6c6f84829
1,096
require 'rails_helper' RSpec.describe Variant, type: :model do let(:product) { create(:product) } let(:variant) { product.variants.create(price: 100) } describe 'create variant' do before { product.variants.create(price: 100) } it 'adds new variant' do expect(product.variants.count).to eq(2) end end describe 'validations' do subject { variant } it { is_expected.to validate_presence_of(:price) } end describe 'associations' do it { is_expected.to belong_to(:product) } it do expect(variant).to have_many(:option_values) .through(:option_value_variants) end it { is_expected.to have_many(:invoice_lines) } it { is_expected.to have_many(:components) } end describe 'enums' do it { is_expected.to define_enum_for(:variant_type) } it { is_expected.to define_enum_for(:selling_policy) } end describe '.search(term)' do before do create(:product, title: 'Hello Tshirt') create(:product, title: 'Bag') end it { expect(described_class.search('ello').count).to eq(1) } end end
23.826087
64
0.671533
1ca0c02760652de7ce79d8874de36ce912119b43
763
class Scrape # Scrapes a given webpage and returns a Nokogiri instance # filtered according to a CSS selector string # .scrape_page : (String, String) -> Nokogiri: instance def self.scrape_page(url, css) html = HTTParty.get(url) scraped_page = Nokogiri::HTML(html) scraped_page.css(css) end # Given a url from the NYT webpage, finds article paragraphs # and returns the first 3 sentences of the article. # .snipped : (String) -> String def self.snippet(url) page = self.scrape_page(url, ".css-1ygdjhk") article = "" page.each do |el| text = el.children.reduce("") {|text, child| text += "#{child.text}" } article << text end article = article.split(/(?<=[\.!?])/) article[0..3].join(" ") end end
29.346154
76
0.647444
ab807278314157568a4de8666811731fac90a302
52
module TransamReporting VERSION = "2.17.0-rc" end
13
23
0.730769
e21734724f8816ad1cbd140a146488495ce687ce
1,216
# -*- encoding: utf-8 -*- # stub: irb 1.4.1 ruby lib Gem::Specification.new do |s| s.name = "irb".freeze s.version = "1.4.1" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Keiju ISHITSUKA".freeze] s.bindir = "exe".freeze s.date = "2021-12-25" s.description = "Interactive Ruby command-line tool for REPL (Read Eval Print Loop).".freeze s.email = ["[email protected]".freeze] s.executables = ["irb".freeze] s.files = ["exe/irb".freeze] s.homepage = "https://github.com/ruby/irb".freeze s.licenses = ["Ruby".freeze, "BSD-2-Clause".freeze] s.required_ruby_version = Gem::Requirement.new(">= 2.5".freeze) s.rubygems_version = "3.2.3".freeze s.summary = "Interactive Ruby command-line tool for REPL (Read Eval Print Loop).".freeze s.installed_by_version = "3.2.3" if s.respond_to? :installed_by_version if s.respond_to? :specification_version then s.specification_version = 4 end if s.respond_to? :add_runtime_dependency then s.add_runtime_dependency(%q<reline>.freeze, [">= 0.3.0"]) else s.add_dependency(%q<reline>.freeze, [">= 0.3.0"]) end end
34.742857
112
0.686678
d54cc5221c6a0aacfd6386f5c89b8aefc238c69b
589
$:.push File.expand_path("lib", __dir__) # Maintain your gem's version: require "sandbox_mail/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "sandbox_mail" s.version = SandboxMail::VERSION s.authors = ["Yuji Yaginuma"] s.email = ["[email protected]"] s.summary = "Don't send mail in sandbox console." s.license = "MIT" s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] s.add_dependency "rails", ">= 5.0" s.add_development_dependency "sqlite3" end
28.047619
83
0.65365
18f28ce8cf9789d609aec42c38c327a015f4baf0
712
class OpenshiftClient < Formula desc "Red Hat OpenShift command-line interface tool" homepage "https://www.openshift.com/" license "Apache-2.0" if OS.mac? url "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.9.10/openshift-client-mac-4.9.10.tar.gz" sha256 "141bd92e16e210db41823f53c15e30b970c3a120f1308a824338a23e426d346e" else url "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.9.10/openshift-client-linux-4.9.10.tar.gz" sha256 "cd819452308e104c8c31656fb005ebf807ede62730cc0a291030c4e64381098b" end def install bin.install "oc" end test do run_output = shell_output("#{bin}/oc 2>&1") assert_match "OpenShift Client", run_output end end
30.956522
111
0.75
1121f5571ec043979f9ffdf692c0ce1fdd5ebea8
66
require_relative '../config/environment' module H4ck3rReader end
13.2
40
0.818182
ed00d4765971e1891dbffb12b9dd5ed2ef8b64b2
345
cask :v1 => 'font-angkor' do version '3.10' sha256 '9435dde7754d90813e017217c7143b92b9cfd7906926cc7c7ee6bd7a0ebb4ea1' url 'https://googlefontdirectory.googlecode.com/hg-history/67342bc472599b4c32201ee4a002fe59a6447a42/ofl/angkor/Angkor.ttf' homepage 'http://www.google.com/fonts/specimen/Angkor' license :ofl font 'Angkor.ttf' end
31.363636
124
0.794203
035b900051dfe68ebe5488934f7fc4757158a3de
5,208
require 'rails_helper' RSpec.describe 'When I visit auditorium index', type: :feature do it 'I can view all information for a selected auditorium' do Auditorium.destroy_all auditorium_1 = Auditorium.create( name: "East 1", capacity: 100, is_imax_auditorium: true) auditorium_2 = Auditorium.create!( name: "North 2", capacity: 100, is_imax_auditorium: true) movie_1 = auditorium_1.movies.create!( name: "The Big Lebowski", showtime_date: "2021-02-12", showtime_start: "13:00:00", duration: 110, ticket_cost: 10.00, is_rated_r: true) movie_2 = auditorium_1.movies.create!( name: "The Big Lebowski", showtime_date: "2021-02-12", showtime_start: "15:15:00", duration: 110, ticket_cost: 10.00, is_rated_r: true) movie_3 = auditorium_2.movies.create!( name: "Star Wars: A New Hope", showtime_date: "2021-02-12", showtime_start: "16:00:00", duration: 108, ticket_cost: 12.00, is_rated_r: false) visit "/auditoriums" click_link("East 1") expect(current_path).to eq("/auditoriums/#{auditorium_1.id}") expect(page).to have_link(href: "/auditoriums") expect(page).to have_content("East 1") expect(page).to have_content("Capacity: 100") expect(page).to have_content("IMAX Auditorium: Yes") expect(page).to have_content("Movies Total: 2") expect(page).to have_link(href: "/auditoriums/#{auditorium_1.id}/edit") expect(page).to have_link(href: "/auditoriums/#{auditorium_1.id}") click_link("Auditoriums") expect(current_path).to eq("/auditoriums") click_link("East 1") click_link("Edit Auditorium") expect(current_path).to eq("/auditoriums/#{auditorium_1.id}/edit") click_button("Update Auditorium") click_link("Delete Auditorium") expect(current_path).to eq("/auditoriums") expect(page).not_to have_content("East 1") end describe 'and I select a link to one auditorium' do it 'it has links to index, edit, and delete' do Auditorium.destroy_all auditorium_1 = Auditorium.create( name: "East 1", capacity: 100, is_imax_auditorium: true) visit "/auditoriums" click_link("East 1") expect(current_path).to eq("/auditoriums/#{auditorium_1.id}") click_link("Auditoriums") expect(current_path).to eq("/auditoriums") click_link("East 1") click_link("Edit Auditorium") expect(current_path).to eq("/auditoriums/#{auditorium_1.id}/edit") click_button("Update Auditorium") click_link("Delete Auditorium") expect(current_path).to eq("/auditoriums") expect(page).not_to have_content("East 1") end it 'it links to the movies associated to that auditorium' do Auditorium.destroy_all auditorium_1 = Auditorium.create( name: "East 1", capacity: 100, is_imax_auditorium: true) auditorium_2 = Auditorium.create!( name: "North 2", capacity: 100, is_imax_auditorium: true) movie_1 = auditorium_1.movies.create!( name: "The Big Lebowski", showtime_date: "2021-02-12", showtime_start: "13:00:00", duration: 110, ticket_cost: 10.00, is_rated_r: true) movie_2 = auditorium_1.movies.create!( name: "The Big Lebowski", showtime_date: "2021-02-12", showtime_start: "15:15:00", duration: 110, ticket_cost: 10.00, is_rated_r: true) movie_3 = auditorium_2.movies.create!( name: "Star Wars: A New Hope", showtime_date: "2021-02-12", showtime_start: "16:00:00", duration: 108, ticket_cost: 12.00, is_rated_r: false) visit "/auditoriums" click_link("East 1") expect(current_path).to eq("/auditoriums/#{auditorium_1.id}") click_link("auditorium_movie_index") expect(current_path).to eq("/auditoriums/#{auditorium_1.id}/movies") expect(page).to have_content("The Big Lebowski") expect(page).to have_content("Movie Starts: Fri Feb 12 2021 03:15 PM") expect(page).to have_content("Auditorium: East 1") expect(page).not_to have_content("Star Wars: A New Hope") end end end
38.577778
76
0.52957
7a3f6fe828d8c0efb88346d31ac0146c66004453
483
require 'ar_finder_form/attr' module ArFinderForm module Attr class Static < Base attr_reader :values def initialize(column, name, values, options) super(column, name, options) @values = values || {} end def setup # do nothing end def build(context) context.add_condition( values.map{|v| "#{column_name(context)} #{v}"}. join(' %s ' % options[:connector])) end end end end
19.32
57
0.569358
08f22f2f10b32343af0cb24567b3bfb3a95780be
784
class HousesController < ApplicationController include ApplicationHelper before_action :authenticate_and_set_user def create house = House.create!(post_params) if house render json: { status: :created, image_url: house.url } else render json: house.errors, status: :unprocessable_entity end end def index render json: { house: House.all, urls: House.pluck(:url) } end def show house = House.find(params[:id]) if house render json: { house: house, url: house.image.service_url } else render json: house.errors, status: :unprocessable_entity end end private def post_params params.permit(:title, :description, :rent, :image) end end
17.818182
62
0.632653
18a2fc6f6dfb109b456d5d368975615912173ff1
1,213
lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'fidor_api/version' Gem::Specification.new do |spec| spec.name = 'fidor_api' spec.version = FidorApi::VERSION spec.authors = ['Fidor Solutions AG'] spec.email = ['[email protected]'] spec.summary = 'Ruby client library to work with Fidor APIs' spec.homepage = 'https://github.com/fidor/fidor_api' spec.license = 'MIT' spec.files = Dir['lib/**/*', 'Rakefile', 'README.md'] spec.bindir = 'exe' spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] spec.add_dependency 'activemodel', '>= 5.0', '< 7' spec.add_dependency 'faraday', '~> 0.15' spec.add_dependency 'faraday_middleware', '~> 0.12' spec.add_dependency 'model_attribute', '~> 3.2' spec.add_development_dependency 'byebug', '~> 11.0' spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3.0' spec.add_development_dependency 'rubocop', '= 0.75.0' spec.add_development_dependency 'simplecov', '~> 0.10' spec.add_development_dependency 'webmock', '~> 3.4' end
39.129032
74
0.657049
112372dcca1e20c983a64246916c7826adbfbea4
2,136
# frozen_string_literal: true require 'spec_helper' require 'aca_entities/medicaid/contracts/medicaid_magi_income_eligibility_basis_contract' RSpec.describe ::AcaEntities::Medicaid::Contracts::MedicaidMagiIncomeEligibilityBasisContract, dbclean: :after_each do let(:required_params) do { status_code: "Complete" } end let(:optional_params) do { status_indicator: true, status_valid_date_range: { start_date: { date: Date.today }, end_date: { date: Date.today } }, ineligibility_reason_text: "n/a", inconsistency_reason_text: "n/a", pending_reason_text: "n/a", determination: { activity_identification: { identification_id: "MET00000000001887090" }, activity_date: { date_time: DateTime.now } }, income_compatibility: { verification_indicator: true, inconsistency_reason_text: "123", compatibility_determination: { activity_identification: { identification_id: "MET00000000001887090" }, activity_date: { date_time: DateTime.now } }, verification_method: "1" }, state_threshold_fpl_percent: "0" } end let(:all_params) { required_params.merge(optional_params) } context 'invalid parameters' do context 'with empty parameters' do it 'should list error for every required parameter' do expect(subject.call({}).errors.to_h.keys).to match_array required_params.keys end end end context 'valid parameters' do context 'with required parameters only' do let(:input_params) { required_params } before do @result = subject.call(input_params) end it { expect(@result.success?).to be_truthy } it { expect(@result.to_h).to eq input_params } end context 'with all required and optional parameters' do it 'should pass validation' do result = subject.call(all_params) expect(result.success?).to be_truthy expect(result.to_h).to eq all_params end end end end
28.105263
118
0.649345
ac80e31ce15b4b8d06c9eb003e5f706331a6d724
1,031
require "formula" class Librem < Formula homepage "http://www.creytiv.com" url "http://www.creytiv.com/pub/rem-0.4.6.tar.gz" sha1 "9698b48aee5e720e56440f4c660d8bd4dbb7f8fa" bottle do cellar :any sha1 "e1089e53d13bd264d8a6b95cce0401c7ae5b6aed" => :mavericks sha1 "8da4a993fa287e444b649b045fdfb48718b733d5" => :mountain_lion sha1 "cb6ace233af76a21ef463f005d13121686ffebeb" => :lion end depends_on "libre" def install libre = Formula["libre"] system "make", "install", "PREFIX=#{prefix}", "LIBRE_MK=#{libre.opt_share}/re/re.mk", "LIBRE_INC=#{libre.opt_include}/re", "LIBRE_SO=#{libre.opt_lib}" end test do (testpath/'test.c').write <<-EOS.undent #include <re/re.h> #include <rem/rem.h> int main() { return (NULL != vidfmt_name(VID_FMT_YUV420P)) ? 0 : 1; } EOS system ENV.cc, "test.c", "-L#{opt_lib}", "-lrem", "-o", "test" system "./test" end end
27.864865
69
0.599418
d5ca56aae26ef68737b4169f6f4d221f2c07d46c
2,878
=begin This file is part of MAMBO, a low-overhead dynamic binary modification tool: https://github.com/beehive-lab/mambo Copyright 2013-2016 Cosmin Gorgovan <cosmin at linux-geek dot org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =end # Quick and dirty generator for emit-style function encoding wrappers for plugins # Takes as argument the path to the C file of an instruction encoder generated by PIE def get_filecode() "__EMIT_#{ARGV[0].gsub(/[^\w]/, "_").upcase}__" end def generate_header() puts "#ifdef PLUGINS_NEW" if (@header_only) puts "#ifndef #{get_filecode()}" puts "#define #{get_filecode()}" end puts "#include \"../dbm.h\"\n" puts "#include \"../#{ARGV[0].gsub(".c", ".h")}\"" puts "#include \"plugin_support.h\"\n" end def generate_footer() if (@header_only) puts "#endif" end puts "#endif" end def rewrite_name(name) name.gsub('void ', 'void emit_') end def generate_body(name, fields, size) puts ")\n{" print "\t#{name}((uint#{@min_size * 8}_t **)(&ctx->code.write_p)" fields.each do |field| print ", #{field}" end puts ");" puts "\tctx->code.write_p += #{size};\n}" end def process_file(filename) fields = [] name = "" size = 0 File.readlines(filename).each do |line| if (line.match(/^void/)) puts rewrite_name(line) line = line.split(' ') name = line[1] fields = [] elsif (line.match(/address,?$/)) print "\tmambo_context *ctx" #get the base instruction size, should be either uint16_t or uint32_t size = line.match(/[0-9]+/)[0].to_i / 8 @min_size = size if (size < @min_size) elsif (line.match(/^\tunsigned int/)) # function arguments, stripped of commas and excluding the address line = line.match(/[\w\s]+/)[0] print ",\n#{line}" line = line.split(' ') fields.push(line[line.size-1]) elsif (line.include?("**address = ") or line.include?("*(*address) =")) puts if (fields.size == 0) if (@header_only) puts ");" else size *= 2 if (line.include?("*(*address")) generate_body(name, fields, size) end end end end abort "Syntax: generate_emit_wrapper.rb <PIE_ENCODER.c> [header]" unless (ARGV[0]) @header_only = true if (ARGV[1] and ARGV[1] == "header") @min_size = 4; generate_header() process_file(ARGV[0]) generate_footer()
27.673077
85
0.649757
ff456daa73d71ef44098ee19d91212ec138915d4
7,228
require "test_helper" require "shrine/plugins/entity" describe Shrine::Plugins::Entity do before do @attacher = attacher { plugin :entity } @shrine = @attacher.shrine_class @entity_class = entity_class(:file_data) end describe "Attachment" do describe ".<name>_attacher" do it "returns attacher instance" do @entity_class.include @shrine::Attachment.new(:file) assert_instance_of @shrine::Attacher, @entity_class.file_attacher end it "sets attacher name" do @entity_class.include @shrine::Attachment.new(:file) assert_equal :file, @entity_class.file_attacher.name end it "applies attachment options" do @entity_class.include @shrine::Attachment.new(:file, store: :other_store) assert_equal :other_store, @entity_class.file_attacher.store_key end it "accepts attacher options" do @entity_class.include @shrine::Attachment.new(:file, store: :other_store) assert_equal :store, @entity_class.file_attacher(store: :store).store_key end end describe "#<name>_attacher" do it "returns the attacher from the entity instance" do @entity_class.include @shrine::Attachment.new(:file) file = @attacher.upload(fakeio) entity = @entity_class.new(file_data: file.to_json) attacher = entity.file_attacher assert_instance_of @shrine::Attacher, attacher assert_equal entity, attacher.record assert_equal :file, attacher.name assert_equal file, attacher.file end it "forwards additional attacher options" do @entity_class.include @shrine::Attachment.new(:file) entity = @entity_class.new attacher = entity.file_attacher(cache: :other_cache) assert_equal :other_cache, attacher.cache_key end it "forwards additional attachment options" do @entity_class.include @shrine::Attachment.new(:file, cache: :other_cache) entity = @entity_class.new attacher = entity.file_attacher assert_equal :other_cache, attacher.cache_key end it "doesn't memoize the attacher" do @entity_class.include @shrine::Attachment.new(:file) entity = @entity_class.new entity.freeze refute_equal entity.file_attacher, entity.file_attacher end end describe "#<name>" do it "returns file if it's attached" do @entity_class.include @shrine::Attachment.new(:file) file = @attacher.upload(fakeio) entity = @entity_class.new(file_data: file.to_json) assert_equal file, entity.file end it "returns nil when no file is attached" do @entity_class.include @shrine::Attachment.new(:file) entity = @entity_class.new assert_nil entity.file end end describe "#<name>_url" do it "returns the attached file URL" do @entity_class.include @shrine::Attachment.new(:file) file = @attacher.upload(fakeio) entity = @entity_class.new(file_data: file.to_json) assert_equal file.url, entity.file_url end it "returns nil when no file is attached" do @entity_class.include @shrine::Attachment.new(:file) entity = @entity_class.new assert_nil entity.file_url end it "forwards additional options" do @entity_class.include @shrine::Attachment.new(:file) file = @attacher.upload(fakeio) entity = @entity_class.new(file_data: file.to_json) file.storage.expects(:url).with(file.id, foo: "bar") entity.file_url(foo: "bar") end end end describe "Attacher" do describe ".from_entity" do it "loads the file from an entity" do file = @attacher.upload(fakeio) entity = @entity_class.new(file_data: file.to_json) attacher = @shrine::Attacher.from_entity(entity, :file) assert_equal file, attacher.file assert_equal entity, attacher.record assert_equal :file, attacher.name end it "forwards additional options to .new" do entity = @entity_class.new attacher = @shrine::Attacher.from_entity(entity, :file, cache: :other_cache) assert_equal :other_cache, attacher.cache_key end end describe "#load_entity" do it "loads file from the data attribute" do file = @attacher.upload(fakeio) entity = @entity_class.new(file_data: file.to_json) @attacher.load_entity(entity, :file) assert_equal file, @attacher.file end it "respects column serializer" do @shrine.plugin :column, serializer: nil file = @attacher.upload(fakeio) entity = @entity_class.new(file_data: file.data) @attacher = @shrine::Attacher.new @attacher.load_entity(entity, :file) assert_equal file, @attacher.file end it "clears file when data attribute is nil" do entity = @entity_class.new @attacher.attach(fakeio) @attacher.load_entity(entity, :file) assert_nil @attacher.file end end describe "#set_entity" do it "saves record and name" do entity = @entity_class.new @attacher.set_entity(entity, :file) assert_equal entity, @attacher.record assert_equal :file, @attacher.name end it "coerces string name into a symbol" do entity = @entity_class.new @attacher.set_entity(entity, "file") assert_equal :file, @attacher.name end it "merges record and name into context" do entity = @entity_class.new @attacher.set_entity(entity, :file) assert_equal Hash[record: entity, name: :file], @attacher.context end end describe "#reload" do it "loads entity file data" do @attacher.load_entity(@entity_class.new, :file) @attacher.attach(fakeio) @attacher.reload assert_nil @attacher.file end end describe "#column_values" do it "returns column values with an attached file" do @attacher.load_entity(@entity_class.new, :file) @attacher.attach(fakeio) assert_equal Hash[file_data: @attacher.file.to_json], @attacher.column_values end it "returns column values with no attached file" do @attacher.load_entity(@entity_class.new, :file) assert_equal Hash[file_data: nil], @attacher.column_values end it "respects column serializer" do @shrine.plugin :column, serializer: nil @attacher = @shrine::Attacher.new @attacher.load_entity(@entity_class.new, :file) @attacher.attach(fakeio) assert_equal Hash[file_data: @attacher.file.data], @attacher.column_values end end describe "#attribute" do it "returns the data attribute name" do @attacher.load_entity(@entity_class.new, :file) assert_equal :file_data, @attacher.attribute end it "returns nil when name is not set" do assert_nil @attacher.attribute end end end end
27.907336
85
0.643331
79c4a96bd454d7f50c47dd2a87b49a449a027808
1,605
# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # GRPC contains the General RPC module. module GRPC VERSION = '1.1.2' end
47.205882
72
0.778816
6a4fc7813265c5d7ca25fb6ee62d0c9323f51e9a
164
# Provide some default implementations of these to make life easier class Wx::DataObjectSimple def get_data_size(format) get_data_here(format).size end end
23.428571
67
0.792683
61095ad51f178153a3751cc0a49bde01bfe387d4
4,972
class ErlangAT18 < Formula desc "Programming language for highly scalable real-time systems" homepage "https://www.erlang.org/" url "https://github.com/erlang/otp/archive/OTP-18.3.4.9.tar.gz" sha256 "25ef8ba3824cb726c4830abf32c2a2967925b1e33a8e8851dba596e933e2689a" bottle do cellar :any sha256 "35ca0e0acbecd171e586bcebb53b2313ca02fc756b390d750cc73ee86f8f6702" => :mojave sha256 "2a379d09b405738143d3f05a719738e2cac285107e1c5115ae6bceb301ef1c44" => :high_sierra sha256 "3d70eb44b2d7e4038d85c946973b57fd1bc0ddfb638e4f84b001393d3bcbc699" => :sierra sha256 "66f38b4af3fc08e302d421d1bd4bd5e40125d920968a46c1aed7d4056ec7a033" => :el_capitan end keg_only :versioned_formula option "without-hipe", "Disable building hipe; fails on various macOS systems" option "with-native-libs", "Enable native library compilation" option "with-dirty-schedulers", "Enable experimental dirty schedulers" option "with-java", "Build jinterface application" option "without-docs", "Do not install documentation" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build depends_on "openssl" depends_on "fop" => :optional # enables building PDF docs depends_on :java => :optional depends_on "wxmac" => :recommended # for GUI apps like observer # Check if this patch can be removed when OTP 18.3.5 is released. # Erlang will crash on macOS 10.13 any time the crypto lib is used. # The Erlang team has an open PR for the patch but it needs to be applied to # older releases. See https://github.com/erlang/otp/pull/1501 and # https://bugs.erlang.org/browse/ERL-439 for additional information. patch do url "https://raw.githubusercontent.com/Homebrew/formula-patches/774ad1f/erlang%4018/boring-ssl-high-sierra.patch" sha256 "7cc1069a2d9418a545e12981c6d5c475e536f58207a1faf4b721cc33692657ac" end # Pointer comparison triggers error with Xcode 9 patch do url "https://github.com/erlang/otp/commit/a64c4d806fa54848c35632114585ad82b98712e8.diff?full_index=1" sha256 "3261400f8d7f0dcff3a52821daea3391ebfa01fd859f9f2d9cc5142138e26e15" end resource "man" do url "https://www.erlang.org/download/otp_doc_man_18.3.tar.gz" sha256 "978be100e9016874921b3ad1a65ee46b7b6a1e597b8db2ec4b5ef436d4c9ecc2" end resource "html" do url "https://www.erlang.org/download/otp_doc_html_18.3.tar.gz" sha256 "8fd6980fd05367735779a487df107ace7c53733f52fbe56de7ca7844a355676f" end def install # Fixes "dyld: Symbol not found: _clock_gettime" # Reported 17 Sep 2016 https://bugs.erlang.org/browse/ERL-256 if MacOS.version == "10.11" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0" ENV["erl_cv_clock_gettime_monotonic_default_resolution"] = "no" ENV["erl_cv_clock_gettime_monotonic_try_find_pthread_compatible"] = "no" ENV["erl_cv_clock_gettime_wall_default_resolution"] = "no" end # Unset these so that building wx, kernel, compiler and # other modules doesn't fail with an unintelligable error. %w[LIBS FLAGS AFLAGS ZFLAGS].each { |k| ENV.delete("ERL_#{k}") } ENV["FOP"] = "#{HOMEBREW_PREFIX}/bin/fop" if build.with? "fop" # Do this if building from a checkout to generate configure system "./otp_build", "autoconf" if File.exist? "otp_build" args = %W[ --disable-debug --disable-silent-rules --prefix=#{prefix} --enable-kernel-poll --enable-threads --enable-sctp --enable-dynamic-ssl-lib --with-ssl=#{Formula["openssl"].opt_prefix} --enable-shared-zlib --enable-smp-support ] args << "--enable-darwin-64bit" if MacOS.prefer_64_bit? args << "--enable-native-libs" if build.with? "native-libs" args << "--enable-dirty-schedulers" if build.with? "dirty-schedulers" args << "--enable-wx" if build.with? "wxmac" args << "--with-dynamic-trace=dtrace" if MacOS::CLT.installed? if build.without? "hipe" # HIPE doesn't strike me as that reliable on macOS # https://syntatic.wordpress.com/2008/06/12/macports-erlang-bus-error-due-to-mac-os-x-1053-update/ # https://www.erlang.org/pipermail/erlang-patches/2008-September/000293.html args << "--disable-hipe" else args << "--enable-hipe" end if build.with? "java" args << "--with-javac" else args << "--without-javac" end system "./configure", *args system "make" ENV.deparallelize # Install is not thread-safe; can try to create folder twice and fail system "make", "install" if build.with? "docs" (lib/"erlang").install resource("man").files("man") doc.install resource("html") end end def caveats; <<~EOS Man pages can be found in: #{opt_lib}/erlang/man Access them with `erl -man`, or add this directory to MANPATH. EOS end test do system "#{bin}/erl", "-noshell", "-eval", "crypto:start().", "-s", "init", "stop" end end
37.954198
117
0.709574
332e540a386874d220b49a5d275e3c0116b7ba0d
4,628
require 'rails_helper' RSpec.describe EphemeraProjectsController, type: :controller do let(:valid_attributes) { { name: "Test Project" } } let(:invalid_attributes) { { name: nil } } let(:user) { FactoryGirl.create(:admin) } before do sign_in user end describe "GET #index" do it "assigns all ephemera_projects as @ephemera_projects" do ephemera_project = EphemeraProject.create! valid_attributes get :index, params: {} expect(assigns(:ephemera_projects)).to eq([ephemera_project]) end end describe "GET #show" do it "assigns the requested ephemera_project as @ephemera_project" do ephemera_project = EphemeraProject.create! valid_attributes get :show, params: { id: ephemera_project.to_param } expect(assigns(:ephemera_project)).to eq(ephemera_project) end end describe "GET #new" do it "assigns a new ephemera_project as @ephemera_project" do get :new, params: {} expect(assigns(:ephemera_project)).to be_a_new(EphemeraProject) end end describe "GET #edit" do it "assigns the requested ephemera_project as @ephemera_project" do ephemera_project = EphemeraProject.create! valid_attributes get :edit, params: { id: ephemera_project.to_param } expect(assigns(:ephemera_project)).to eq(ephemera_project) end end describe "POST #create" do context "with valid params" do it "creates a new EphemeraProject" do expect { post :create, params: { ephemera_project: valid_attributes } }.to change(EphemeraProject, :count).by(1) end it "assigns a newly created ephemera_project as @ephemera_project" do post :create, params: { ephemera_project: valid_attributes } expect(assigns(:ephemera_project)).to be_a(EphemeraProject) expect(assigns(:ephemera_project)).to be_persisted end it "redirects to the created ephemera_project" do post :create, params: { ephemera_project: valid_attributes } expect(response).to redirect_to(EphemeraProject.last) end end context "with invalid params" do it "assigns a newly created but unsaved ephemera_project as @ephemera_project" do post :create, params: { ephemera_project: invalid_attributes } expect(assigns(:ephemera_project)).to be_a_new(EphemeraProject) end end end describe "PUT #update" do context "with valid params" do let(:new_attributes) { { name: "Updated Name" } } it "updates the requested ephemera_project" do ephemera_project = EphemeraProject.create! valid_attributes put :update, params: { id: ephemera_project.to_param, ephemera_project: new_attributes } ephemera_project.reload expect(ephemera_project.name).to eq("Updated Name") end it "assigns the requested ephemera_project as @ephemera_project" do ephemera_project = EphemeraProject.create! valid_attributes put :update, params: { id: ephemera_project.to_param, ephemera_project: valid_attributes } expect(assigns(:ephemera_project)).to eq(ephemera_project) end it "redirects to the ephemera_project" do ephemera_project = EphemeraProject.create! valid_attributes put :update, params: { id: ephemera_project.to_param, ephemera_project: valid_attributes } expect(response).to redirect_to(ephemera_project) end end context "with invalid params" do it "assigns the ephemera_project as @ephemera_project" do ephemera_project = EphemeraProject.create! valid_attributes put :update, params: { id: ephemera_project.to_param, ephemera_project: invalid_attributes } expect(assigns(:ephemera_project)).to eq(ephemera_project) end it "re-renders the 'edit' template" do ephemera_project = EphemeraProject.create! valid_attributes put :update, params: { id: ephemera_project.to_param, ephemera_project: invalid_attributes } expect(response).to render_template("edit") end end end describe "DELETE #destroy" do it "destroys the requested ephemera_project" do ephemera_project = EphemeraProject.create! valid_attributes expect { delete :destroy, params: { id: ephemera_project.to_param } }.to change(EphemeraProject, :count).by(-1) end it "redirects to the ephemera_projects list" do ephemera_project = EphemeraProject.create! valid_attributes delete :destroy, params: { id: ephemera_project.to_param } expect(response).to redirect_to(ephemera_projects_url) end end end
37.024
100
0.705704
390cb73895abb2ce349e982f5f615ad7999d8ece
2,789
require 'economic/entity' module Economic # Represents an account. # # API documentation: http://e-conomic.github.com/eco-api-sdk-ref-docs/Documentation/ # # Examples # # # Find account # account = economic.accounts.find(1000) # # # Creating an account # account = economic.accounts.build # account.number = '1050' # account.name = 'Sales in EU' # account.type = 'ProfitAndLoss' # account.debit_credit = 'Credit' # account.vat_account_handle = { :vat_code => "B25" } # account.save # # Account types # ProfitAndLoss, Status, TotalFrom, Heading, HeadingStart, SumInterval class Account < Entity has_properties :name, :number, :balance, :block_direct_entries, :contra_account_handle, :debit_credit, :department_handle, :distribution_key_handle, :is_accessible, :opening_account_handle, :total_from_handle, :type, :vat_account_handle def handle Handle.new({:number => @number}) end protected def initialize_defaults self.name = "Test" self.balance = 0 self.block_direct_entries = false self.debit_credit = "Debit" self.department_handle = nil self.distribution_key_handle = nil self.is_accessible = true self.type = "ProfitAndLoss" self.vat_account_handle = nil self.contra_account_handle = nil self.opening_account_handle = nil self.total_from_handle = nil end def build_soap_data data = ActiveSupport::OrderedHash.new data['Handle'] = handle.to_hash data['Number'] = number data['Name'] = name data['Type'] = type data['DebitCredit'] = debit_credit unless debit_credit.blank? data['IsAccessible'] = is_accessible unless is_accessible.blank? data['BlockDirectEntries'] = block_direct_entries if (type == "ProfitAndLoss" || type == "Status") data['VatAccountHandle'] = { 'VatCode' => vat_account_handle[:vat_code] } unless vat_account_handle.blank? data['ContraAccountHandle'] = { 'Number' => contra_account_handle[:number] } unless contra_account_handle.blank? end data['OpeningAccountHandle'] = { 'Number' => opening_account_handle[:number] } unless opening_account_handle.blank? || type != "Status" data['TotalFromHandle'] = { 'Number' => total_from_handle[:number] } unless total_from_handle.blank? || type != "TotalFrom" data['Balance'] = balance data['DepartmentHandle'] = { 'Number' => department_handle[:number] } unless department_handle.blank? data['DistributionKeyHandle'] = { 'Number' => distribution_key_handle[:number] } unless distribution_key_handle.blank? return data end end end
31.337079
141
0.657583
f8279f10d6474d7e712cb1d2d82e59fb315864a7
2,079
require_relative "env" module CypressRails class Config attr_accessor :dir, :host, :port, :base_path, :transactional_server, :cypress_cli_opts, :cypress_path, :cypress_base_url, :cypress_dir def initialize( dir: Env.fetch("CYPRESS_RAILS_DIR", default: Dir.pwd), host: Env.fetch("CYPRESS_RAILS_HOST", default: "127.0.0.1"), port: Env.fetch("CYPRESS_RAILS_PORT"), base_path: Env.fetch("CYPRESS_RAILS_BASE_PATH", default: "/"), transactional_server: Env.fetch("CYPRESS_RAILS_TRANSACTIONAL_SERVER", type: :boolean, default: true), cypress_cli_opts: Env.fetch("CYPRESS_RAILS_CYPRESS_OPTS", default: ""), cypress_path: Env.fetch("CYPRESS_RAILS_CYPRESS_PATH", default: "node_modules/.bin/cypress"), cypress_base_url: Env.fetch("CYPRESS_BASE_URL", default: nil), cypress_dir: Env.fetch("CYPRESS_DIR", default: nil) ) @dir = dir @host = host @port = port @base_path = base_path @transactional_server = transactional_server @cypress_cli_opts = cypress_cli_opts @cypress_path = cypress_path @cypress_base_url = cypress_base_url @cypress_dir = cypress_dir end def to_s <<~DESC cypress-rails configuration: ============================ CYPRESS_RAILS_DIR.....................#{dir.inspect} CYPRESS_RAILS_HOST....................#{host.inspect} CYPRESS_RAILS_PORT....................#{port.inspect} CYPRESS_RAILS_BASE_PATH...............#{base_path.inspect} CYPRESS_RAILS_TRANSACTIONAL_SERVER....#{transactional_server.inspect} CYPRESS_RAILS_CYPRESS_OPTS............#{cypress_cli_opts.inspect} CYPRESS_RAILS_CYPRESS_PATH............#{cypress_path.inspect} CYPRESS_BASE_URL......................#{cypress_base_url.inspect} CYPRESS_DIR...........................#{cypress_dir.inspect} DESC end end end
37.125
107
0.589226
5d4e579c6abf6dda20e76f5c7749d63f846953f0
507
module ApplicationHelper # Mapping from devise flast type to corresponding bootstrap class def bootstrap_class_for(flash_type) if flash_type == "success" return "alert-success" # Green elsif flash_type == "error" return "alert-danger" # Red elsif flash_type == "alert" return "alert-warning" # Yellow elsif flash_type == "notice" return "alert-info" # Blue else return flash_type.to_s end end end
26.684211
67
0.609467
28247da7d66eb72e399d2a26db459f8259689c79
6,235
module Elastic module API module Actions # Return documents similar to the specified one. # # Performs a `more_like_this` query with the specified document as the input. # # @example Search for similar documents using the `title` property of document `myindex/mytype/1` # # # First, let's setup a synonym-aware analyzer ("quick" <=> "fast") # client.indices.create index: 'myindex', body: { # settings: { # analysis: { # filter: { # synonyms: { # type: 'synonym', # synonyms: [ "quick,fast" ] # } # }, # analyzer: { # title_synonym: { # type: 'custom', # tokenizer: 'whitespace', # filter: ['lowercase', 'stop', 'snowball', 'synonyms'] # } # } # } # }, # mappings: { # mytype: { # properties: { # title: { # type: 'string', # analyzer: 'title_synonym' # } # } # } # } # } # # # Index three documents # client.index index: 'myindex', type: 'mytype', id: 1, body: { title: 'Quick Brown Fox' } # client.index index: 'myindex', type: 'mytype', id: 2, body: { title: 'Slow Black Dog' } # client.index index: 'myindex', type: 'mytype', id: 3, body: { title: 'Fast White Rabbit' } # client.indices.refresh index: 'myindex' # # client.mlt index: 'myindex', type: 'mytype', id: 1, mlt_fields: 'title', min_doc_freq: 1, min_term_freq: 1 # # => { ... {"title"=>"Fast White Rabbit"}}]}} # # @option arguments [String] :id The document ID (*Required*) # @option arguments [String] :index The name of the index (*Required*) # @option arguments [String] :type The type of the document (use `_all` to fetch # the first document matching the ID across all types) (*Required*) # @option arguments [Hash] :body A specific search request definition # @option arguments [Number] :boost_terms The boost factor # @option arguments [Number] :max_doc_freq The word occurrence frequency as count: words with higher occurrence # in the corpus will be ignored # @option arguments [Number] :max_query_terms The maximum query terms to be included in the generated query # @option arguments [Number] :max_word_len The minimum length of the word: longer words will be ignored # @option arguments [Number] :min_doc_freq The word occurrence frequency as count: words with lower occurrence # in the corpus will be ignored # @option arguments [Number] :min_term_freq The term frequency as percent: terms with lower occurence # in the source document will be ignored # @option arguments [Number] :min_word_len The minimum length of the word: shorter words will be ignored # @option arguments [List] :mlt_fields Specific fields to perform the query against # @option arguments [Number] :percent_terms_to_match How many terms have to match in order to consider # the document a match (default: 0.3) # @option arguments [String] :routing Specific routing value # @option arguments [Number] :search_from The offset from which to return results # @option arguments [List] :search_indices A comma-separated list of indices to perform the query against # (default: the index containing the document) # @option arguments [String] :search_query_hint The search query hint # @option arguments [String] :search_scroll A scroll search request definition # @option arguments [Number] :search_size The number of documents to return (default: 10) # @option arguments [String] :search_source A specific search request definition (instead of using the request body) # @option arguments [String] :search_type Specific search type (eg. `dfs_then_fetch`, `count`, etc) # @option arguments [List] :search_types A comma-separated list of types to perform the query against # (default: the same type as the document) # @option arguments [List] :stop_words A list of stop words to be ignored # # @see http://elastic.org/guide/reference/api/more-like-this/ # def mlt(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] raise ArgumentError, "Required argument 'id' missing" unless arguments[:id] valid_params = [ :boost_terms, :max_doc_freq, :max_query_terms, :max_word_len, :min_doc_freq, :min_term_freq, :min_word_len, :mlt_fields, :percent_terms_to_match, :routing, :search_from, :search_indices, :search_query_hint, :search_scroll, :search_size, :search_source, :search_type, :search_types, :stop_words ] method = HTTP_GET path = Utils.__pathify Utils.__escape(arguments[:index]), Utils.__escape(arguments[:type]), Utils.__escape(arguments[:id]), '_mlt' params = Utils.__validate_and_extract_params arguments, valid_params [:mlt_fields, :search_indices, :search_types, :stop_words].each do |name| params[name] = Utils.__listify(params[name]) if params[name] end body = arguments[:body] perform_request(method, path, params, body).body end end end end
48.333333
122
0.561508
f821a9021302f7d9f3a8932b95d3180fb559287d
1,843
#-- copyright # OpenProject is a project management system. # Copyright (C) 2012-2018 the OpenProject Foundation (OPF) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: # Copyright (C) 2006-2017 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # See docs/COPYRIGHT.rdoc for more details. #++ module API module V3 module Attachments class AttachmentsByMeetingContentAPI < ::API::OpenProjectAPI resources :attachments do helpers API::V3::Attachments::AttachmentsByContainerAPI::Helpers helpers do def container meeting_content end def get_attachment_self_path api_v3_paths.attachments_by_meeting_content container.id end end get &API::V3::Attachments::AttachmentsByContainerAPI.read post &API::V3::Attachments::AttachmentsByContainerAPI.create end end end end end
34.773585
91
0.716224
ff54bc951af68b93c43d818fa349ff664f4a16b1
773
module VagrantPlugins module Vmck class Plugin < Vagrant.plugin('2') name "Vmck" config :vmck, :provider do require_relative 'config' Config end provider :vmck do setup_logging require_relative 'provider' Provider end def self.setup_logging require "log4r" level = nil begin level = Log4r.const_get(ENV["VAGRANT_LOG"].upcase) rescue NameError level = nil end level = nil if !level.is_a?(Integer) if level logger = Log4r::Logger.new("vagrant_vmck") logger.outputters = Log4r::Outputter.stderr logger.level = level logger = nil end end end end end
18.853659
60
0.552393
fffe99ff1f9b5a44687c95d616c440715024e240
422
require_relative '../../support/feature_helper' describe "NPM Dependencies" do # As a Node developer # I want to be able to manage NPM dependencies let(:node_developer) { LicenseFinder::TestingDSL::User.new } specify "are shown in reports" do LicenseFinder::TestingDSL::NpmProject.create node_developer.run_license_finder expect(node_developer).to be_seeing_line "http-server, 0.6.1, MIT" end end
28.133333
70
0.748815
1a7e7a672533be6ae73eb57aab1a3248b3c4108e
211
class CreateShows < ActiveRecord::Migration def change create_table :shows do |t| t.string :date t.integer :venue_id t.string :url t.timestamps null: false end end end
17.583333
43
0.625592
08644777919d3456d5d35b92dc4ce3070b4a4046
524
module VueCli module Rails module Helper def vue_entry(entry) assets = VueCli::Rails::Configuration.instance.entry_assets(entry) raise(ArgumentError, "Vue entry (#{entry}) not found!") if assets.blank? tags = ''.dup (assets['css'] || []).each do |css| tags << %{<link href="#{css}" rel="stylesheet">} end (assets['js'] || []).each do |js| tags << %{<script src="#{js}"></script>} end tags.html_safe end end end end
26.2
80
0.534351
26bb09b8fbd7c99fccd2c79d09d09ba7ae43ab99
509
class Admin::PetitionDepartmentsController < Admin::AdminController before_action :fetch_petition def show render 'admin/petitions/show' end def update if @petition.update(petition_params) redirect_to [:admin, @petition], notice: :petition_updated else render 'admin/petitions/show' end end private def fetch_petition @petition = Petition.find(params[:petition_id]) end def petition_params params.require(:petition).permit(departments: []) end end
19.576923
67
0.719057
1a41f9dbeb6929e72fbdbf571e113fae9c00103d
593
require 'spec_helper' describe "member_agents_nodes_photo_spot", type: :feature, dbscope: :example do let(:site) { cms_site } let(:layout) { create_cms_layout } let(:node) { create :member_node_photo_spot, layout_id: layout.id, filename: "node" } context "public" do let!(:item) { create :member_photo_spot, filename: "node/item" } before do Capybara.app_host = "http://#{site.domain}" end it "#index" do visit node.url expect(page).to have_css(".member-photos") expect(page).to have_selector(".member-photos article") end end end
26.954545
89
0.667791
33f15b3bad41d4a1664e6b4c04e935cde156cc38
1,149
class Game attr_gtk def method1 num method2 num end def method2 num method3 num end def method3 num method4 num end def method4 num if num == 1 puts "UNLUCKY #{num}." state.unlucky_count += 1 if state.unlucky_count > 3 raise "NAT 1 finally occurred. Check app/trace.txt for all method invocation history." end else puts "LUCKY #{num}." end end def tick state.roll_history ||= [] state.roll_history << rand(20) + 1 state.countdown ||= 600 state.countdown -= 1 state.unlucky_count ||= 0 outputs.labels << [640, 360, "A dice roll of 1 will cause an exception.", 0, 1] if state.countdown > 0 outputs.labels << [640, 340, "Dice roll countdown: #{state.countdown}", 0, 1] else state.attempts ||= 0 state.attempts += 1 outputs.labels << [640, 340, "ROLLING! #{state.attempts}", 0, 1] end return if state.countdown > 0 method1 state.roll_history[-1] end end $game = Game.new def tick args trace! $game # <------------------- TRACING ENABLED FOR THIS OBJECT $game.args = args $game.tick end
21.277778
94
0.604003
f7d4516191ef505efd3f93a204081a529f35c3f9
40
module Mailtime VERSION = "0.0.1" end
10
19
0.675
6a7dae642ece6687d78903f4fc6822849232cd33
2,433
require File.expand_path('../boot', __FILE__) require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.require(:default, :assets, Rails.env) end module RailsApp class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. # Custom directories with classes and modules you want to be autoloadable. # config.autoload_paths += %W(#{config.root}/extras) # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named. # config.plugins = [ :exception_notification, :ssl_requirement, :all ] # Activate observers that should always be running. # config.active_record.observers = :cacher, :garbage_collector, :forum_observer # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters += [:password] # Use SQL instead of Active Record's schema dumper when creating the database. # This is necessary if your schema can't be completely dumped by the schema dumper, # like if you have constraints or database-specific column types # config.active_record.schema_format = :sql # Enable the asset pipeline config.assets.enabled = true # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' # Avoid deprecation warning config.active_record.raise_in_transactional_callbacks = true end end
42.684211
99
0.728319
285b35fefcaf2b0a38f6a5f6f49c0d1e8a0e8909
2,906
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'layouts/nav/sidebar/_admin' do shared_examples 'page has active tab' do |title| it "activates #{title} tab" do render expect(rendered).to have_selector('.nav-sidebar .sidebar-top-level-items > li.active', count: 1) expect(rendered).to have_css('.nav-sidebar .sidebar-top-level-items > li.active', text: title) end end shared_examples 'page has active sub tab' do |title| it "activates #{title} sub tab" do render expect(rendered).to have_css('.sidebar-sub-level-items > li.active', text: title) end end context 'on home page' do before do allow(controller).to receive(:controller_name).and_return('dashboard') end it_behaves_like 'page has active tab', 'Overview' end it_behaves_like 'has nav sidebar' context 'on projects' do before do allow(controller).to receive(:controller_name).and_return('projects') allow(controller).to receive(:controller_path).and_return('admin/projects') end it_behaves_like 'page has active tab', 'Overview' it_behaves_like 'page has active sub tab', 'Projects' end context 'on groups' do before do allow(controller).to receive(:controller_name).and_return('groups') end it_behaves_like 'page has active tab', 'Overview' it_behaves_like 'page has active sub tab', 'Groups' end context 'on users' do before do allow(controller).to receive(:controller_name).and_return('users') end it_behaves_like 'page has active tab', 'Overview' it_behaves_like 'page has active sub tab', 'Users' end context 'on messages' do before do allow(controller).to receive(:controller_name).and_return('broadcast_messages') end it_behaves_like 'page has active tab', 'Messages' end context 'on analytics' do before do allow(controller).to receive(:controller_name).and_return('dev_ops_score') end it_behaves_like 'page has active tab', 'Analytics' end context 'on hooks' do before do allow(controller).to receive(:controller_name).and_return('hooks') end it_behaves_like 'page has active tab', 'Hooks' end context 'on background jobs' do before do allow(controller).to receive(:controller_name).and_return('background_jobs') end it_behaves_like 'page has active tab', 'Monitoring' it_behaves_like 'page has active sub tab', 'Background Jobs' end context 'on settings' do before do render end it 'includes General link' do expect(rendered).to have_link('General', href: general_admin_application_settings_path) end context 'when GitLab FOSS' do it 'does not include Templates link' do expect(rendered).not_to have_link('Templates', href: '/admin/application_settings/templates') end end end end
26.418182
102
0.694425
7a5d0c0ad2a54dfbbc7f9233af8c202f532d55d8
1,736
require 'spec_helper' describe Ravelin::Order do describe '#items=' do let(:order) { described_class.new(order_id: 1, items: items, status: { stage: 'cancelled', reason: 'buyer' }) } context 'argument not an array' do let(:items) { 'a string' } it 'raises ArgumentError' do expect { order }.to raise_exception(ArgumentError) end end context 'argument is an array' do let(:items) { [ { sku: 1, quantity: 1 }, { sku: 2, quantity: 1 }] } it 'converts Array items into Ravelin::Items' do expect(order.items).to include( instance_of(Ravelin::Item), instance_of(Ravelin::Item) ) end end end describe '#app=' do let(:order) { described_class.new(order_id: 1, app: { name: "my cool app", platform: "web"}) } it 'has an app set' do expect(order.app.name).to eql("my cool app") expect(order.app.domain).to be_nil expect(order.app.platform).to eql("web") end context 'with an invalid platform' do let(:order) { described_class.new(order_id: 1, app: { name: "my cool app", platform: "shoes"}) } it 'fails validation' do expect { order }.to raise_error(ArgumentError) end end context 'with a valid domain' do let(:order) { described_class.new(order_id: 1, app: { name: "my cool app", domain: "a1.b.com"}) } it 'is valid' do expect { order }.not_to raise_error end end context 'with an invalid domain' do let(:order) { described_class.new(order_id: 1, app: { name: "my cool app", domain: "http://a1.b.com"}) } it 'fails validation' do expect { order }.to raise_error(ArgumentError) end end end end
28.933333
115
0.607143
2121b5dc1e30e4953e531054725346ff06a9d6c3
12,711
# Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmation, reset password and unlock tokens in the database. # config.secret_key = '534e8e4eb6908b82fa2f76dbb4415c053d3348d3888186288f8dae8075a6489828522a93a0933740149ae4a903f9b7c202a3246748648100f4b8b0c9301cc8c0' # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. config.mailer_sender = '[email protected]' # Configure the class responsible to send e-mails. # config.mailer = 'Devise::Mailer' # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default) and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional gems. require 'devise/orm/active_record' # ==> Configuration for any authentication mechanism # Configure which keys are used when authenticating a user. The default is # just :email. You can configure it to use [:username, :subdomain], so for # authenticating a user, both parameters are required. Remember that those # parameters are used only when authenticating and not when retrieving from # session. If you need permissions, you should implement that in a before filter. # You can also supply a hash where the value is a boolean determining whether # or not authentication should be aborted when the value is not present. # config.authentication_keys = [ :email ] # Configure parameters from the request object used for authentication. Each entry # given should be a request method and it will automatically be passed to the # find_for_authentication method and considered in your model lookup. For instance, # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. # The same considerations mentioned for authentication_keys also apply to request_keys. # config.request_keys = [] # Configure which authentication keys should be case-insensitive. # These keys will be downcased upon creating or modifying a user and when used # to authenticate or find a user. Default is :email. config.case_insensitive_keys = [ :email ] # Configure which authentication keys should have whitespace stripped. # These keys will have whitespace before and after removed upon creating or # modifying a user and when used to authenticate or find a user. Default is :email. config.strip_whitespace_keys = [ :email ] # Tell if authentication through request.params is enabled. True by default. # It can be set to an array that will enable params authentication only for the # given strategies, for example, `config.params_authenticatable = [:database]` will # enable it only for database (email + password) authentication. # config.params_authenticatable = true # Tell if authentication through HTTP Auth is enabled. False by default. # It can be set to an array that will enable http authentication only for the # given strategies, for example, `config.http_authenticatable = [:database]` will # enable it only for database authentication. The supported strategies are: # :database = Support basic authentication with authentication key + password # config.http_authenticatable = false # If 401 status code should be returned for AJAX requests. True by default. # config.http_authenticatable_on_xhr = true # The realm used in Http Basic Authentication. 'Application' by default. # config.http_authentication_realm = 'Application' # It will change confirmation, password recovery and other workflows # to behave the same regardless if the e-mail provided was right or wrong. # Does not affect registerable. # config.paranoid = true # By default Devise will store the user in session. You can skip storage for # particular strategies by setting this option. # Notice that if you are skipping storage for all authentication paths, you # may want to disable generating routes to Devise's sessions controller by # passing skip: :sessions to `devise_for` in your config/routes.rb config.skip_session_storage = [:http_auth] # By default, Devise cleans up the CSRF token on authentication to # avoid CSRF token fixation attacks. This means that, when using AJAX # requests for sign in and sign up, you need to get a new CSRF token # from the server. You can disable this option at your own risk. # config.clean_up_csrf_token_on_authentication = true # ==> Configuration for :database_authenticatable # For bcrypt, this is the cost for hashing the password and defaults to 10. If # using other encryptors, it sets how many times you want the password re-encrypted. # # Limiting the stretches to just one in testing will increase the performance of # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use # a value less than 10 in other environments. Note that, for bcrypt (the default # encryptor), the cost increases exponentially with the number of stretches (e.g. # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). config.stretches = Rails.env.test? ? 1 : 10 # Setup a pepper to generate the encrypted password. # config.pepper = '55fad9626806ff5305f3358d511be0a35dc57b1dda0e6ad23a5cc1acce1316e0e9eac1b7c41ac28804537662de02c78cf4aa2537ea4f0c73488fb044a7fbb272' # ==> Configuration for :confirmable # A period that the user is allowed to access the website even without # confirming their account. For instance, if set to 2.days, the user will be # able to access the website for two days without confirming their account, # access will be blocked just in the third day. Default is 0.days, meaning # the user cannot access the website without confirming their account. # config.allow_unconfirmed_access_for = 2.days # A period that the user is allowed to confirm their account before their # token becomes invalid. For example, if set to 3.days, the user can confirm # their account within 3 days after the mail was sent, but on the fourth day # their account can't be confirmed with the token any more. # Default is nil, meaning there is no restriction on how long a user can take # before confirming their account. # config.confirm_within = 3.days # If true, requires any email changes to be confirmed (exactly the same way as # initial account confirmation) to be applied. Requires additional unconfirmed_email # db field (see migrations). Until confirmed, new email is stored in # unconfirmed_email column, and copied to email column on successful confirmation. config.reconfirmable = true # Defines which key will be used when confirming an account # config.confirmation_keys = [ :email ] # ==> Configuration for :rememberable # The time the user will be remembered without asking for credentials again. # config.remember_for = 2.weeks # Invalidates all the remember me tokens when the user signs out. config.expire_all_remember_me_on_sign_out = true # If true, extends the user's remember period when remembered via cookie. # config.extend_remember_period = false # Options to be passed to the created cookie. For instance, you can set # secure: true in order to force SSL only cookies. # config.rememberable_options = {} # ==> Configuration for :validatable # Range for password length. config.password_length = 4..128 # Email regex used to validate email formats. It simply asserts that # one (and only one) @ exists in the given string. This is mainly # to give user feedback and not to assert the e-mail validity. # config.email_regexp = /\A[^@]+@[^@]+\z/ # ==> Configuration for :timeoutable # The time you want to timeout the user session without activity. After this # time the user will be asked for credentials again. Default is 30 minutes. # config.timeout_in = 30.minutes # If true, expires auth token on session timeout. # config.expire_auth_token_on_timeout = false # ==> Configuration for :lockable # Defines which strategy will be used to lock an account. # :failed_attempts = Locks an account after a number of failed attempts to sign in. # :none = No lock strategy. You should handle locking by yourself. # config.lock_strategy = :failed_attempts # Defines which key will be used when locking and unlocking an account # config.unlock_keys = [ :email ] # Defines which strategy will be used to unlock an account. # :email = Sends an unlock link to the user email # :time = Re-enables login after a certain amount of time (see :unlock_in below) # :both = Enables both strategies # :none = No unlock strategy. You should handle unlocking by yourself. # config.unlock_strategy = :both # Number of authentication tries before locking an account if lock_strategy # is failed attempts. # config.maximum_attempts = 20 # Time interval to unlock the account if :time is enabled as unlock_strategy. # config.unlock_in = 1.hour # Warn on the last attempt before the account is locked. # config.last_attempt_warning = true # ==> Configuration for :recoverable # # Defines which key will be used when recovering the password for an account # config.reset_password_keys = [ :email ] # Time interval you can reset your password with a reset password key. # Don't put a too small interval or your users won't have the time to # change their passwords. config.reset_password_within = 6.hours # ==> Configuration for :encryptable # Allow you to use another encryption algorithm besides bcrypt (default). You can use # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) # and :restful_authentication_sha1 (then you should set stretches to 10, and copy # REST_AUTH_SITE_KEY to pepper). # # Require the `devise-encryptable` gem when using anything other than bcrypt # config.encryptor = :sha512 # ==> Scopes configuration # Turn scoped views on. Before rendering "sessions/new", it will first check for # "users/sessions/new". It's turned off by default because it's slower if you # are using only default views. # config.scoped_views = false # Configure the default scope given to Warden. By default it's the first # devise role declared in your routes (usually :user). # config.default_scope = :user # Set this configuration to false if you want /users/sign_out to sign out # only the current scope. By default, Devise signs out all scopes. # config.sign_out_all_scopes = true # ==> Navigation configuration # Lists the formats that should be treated as navigational. Formats like # :html, should redirect to the sign in page when the user does not have # access, but formats like :xml or :json, should return 401. # # If you have any extra navigational formats, like :iphone or :mobile, you # should add them to the navigational formats lists. # # The "*/*" below is required to match Internet Explorer requests. # config.navigational_formats = ['*/*', :html] # The default HTTP method used to sign out a resource. Default is :delete. config.sign_out_via = :delete # ==> OmniAuth # Add a new OmniAuth provider. Check the wiki for more information on setting # up on your models and hooks. # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' # ==> Warden configuration # If you want to use other strategies, that are not supported by Devise, or # change the failure app, you can configure them inside the config.warden block. # # config.warden do |manager| # manager.intercept_401 = false # manager.default_strategies(scope: :user).unshift :some_external_strategy # end # ==> Mountable engine configurations # When using Devise inside an engine, let's call it `MyEngine`, and this engine # is mountable, there are some extra configurations to be taken into account. # The following options are available, assuming the engine is mounted as: # # mount MyEngine, at: '/my_engine' # # The router that invoked `devise_for`, in the example above, would be: # config.router_name = :my_engine # # When using omniauth, Devise cannot automatically set Omniauth path, # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = '/my_engine/users/auth' end
48.888462
154
0.74998
ffc320fd3bd043040b8faf400f0e327c46143b17
1,355
module SimpleGdrive # Uploads file class Uploader < Base FOLDER_MIME_TYPE = 'application/vnd.google-apps.folder'.freeze OPTIONS = {retries: 5}.freeze def initialize(base_folder_id:) @base_folder_id = base_folder_id end def call(full_filename, upload_source, content_type:, mime_type: nil) names = full_filename.split('/') filename = names.pop parent_id = find_folder(names) meta = {name: filename, parents: [parent_id]} meta[:mime_type] = mime_type if mime_type file = service.create_file( meta, upload_source: upload_source, content_type: content_type, options: OPTIONS ) {id: file.id, parent_id: parent_id} end private def find_folder(names) id = @base_folder_id names.each { |folder_name| id = find_or_create_folder(folder_name, id) } id end def find_or_create_folder(name, parent_id = nil) folder_id = parent_id || @base_folder_id res = service.list_files( q: "mimeType='#{FOLDER_MIME_TYPE}' and name='#{name}' and '#{folder_id}' in parents and not trashed" ) return res.files.first.id if res.files.any? service.create_file( {name: name, mime_type: FOLDER_MIME_TYPE, parents: [folder_id]}, options: OPTIONS ).id end end end
24.636364
108
0.64428
f76ed18d7181d028cb1eae62e77efee51f3292cd
220
require "spec_helper" describe HonorificPrefixable do it "has a version number" do expect(HonorificPrefixable::VERSION).not_to be nil end it "does something useful" do expect(false).to eq(true) end end
18.333333
54
0.736364
6a230b422f853280f2c8f481c8bc4c4b5d849eb9
2,558
require 'spec_helper' RSpec.describe Steps::Details::HasRepresentativeForm do let(:arguments) { { tribunal_case: tribunal_case, has_representative: has_representative } } let(:tribunal_case) { instance_double(TribunalCase, has_representative: nil) } let(:has_representative) { nil } subject { described_class.new(arguments) } describe '#save' do context 'when no tribunal_case is associated with the form' do let(:tribunal_case) { nil } let(:has_representative) { 'yes' } it 'raises an error' do expect { subject.save }.to raise_error(RuntimeError) end end context 'when has_representative is not given' do it 'returns false' do expect(subject.save).to be(false) end it 'has a validation error on the field' do expect(subject).to_not be_valid expect(subject.errors[:has_representative]).to_not be_empty end end context 'when has_representative is not valid' do let(:has_representative) { 'Alan Shore' } it 'returns false' do expect(subject.save).to be(false) end it 'has a validation error on the field' do expect(subject).to_not be_valid expect(subject.errors[:has_representative]).to_not be_empty end end context 'when has_representative is valid' do let(:has_representative) { 'yes' } it 'saves the record' do expect(tribunal_case).to receive(:update).with( has_representative: HasRepresentative::YES, representative_professional_status: nil, representative_individual_first_name: nil, representative_individual_last_name: nil, representative_organisation_name: nil, representative_organisation_registration_number: nil, representative_organisation_fao: nil, representative_contact_address: nil, representative_contact_postcode: nil, representative_contact_email: nil, representative_contact_phone: nil ).and_return(true) expect(subject.save).to be(true) end end context 'when has_representative is already the same on the model' do let(:tribunal_case) { instance_double( TribunalCase, has_representative: HasRepresentative::NO ) } let(:has_representative) { 'no' } it 'does not save the record but returns true' do expect(tribunal_case).to_not receive(:update) expect(subject.save).to be(true) end end end end
30.452381
80
0.667318
e90105541ea195743da595dae904a359cdd5c498
2,185
# coding: utf-8 require 'spec_helper' describe ActiveInteraction::InputProcessor do describe '.reserved?(name)' do it 'returns true for anything starting with "_interaction_"' do expect(described_class.reserved?('_interaction_')).to be_truthy end # rubocop:disable Metrics/LineLength it 'returns true for existing instance methods' do ( (ActiveInteraction::Base.instance_methods - Object.instance_methods) + (ActiveInteraction::Base.private_instance_methods - Object.private_instance_methods) ).each do |method| expect(described_class.reserved?(method)).to be_truthy end end # rubocop:enable Metrics/LineLength it 'returns false for anything else' do expect(described_class.reserved?(SecureRandom.hex)).to be_falsey end end describe '.process(inputs)' do let(:inputs) { {} } let(:result) { described_class.process(inputs) } context 'with simple inputs' do before { inputs[:key] = :value } it 'sends them straight through' do expect(result).to eql inputs end end context 'with groupable inputs' do context 'without a matching simple input' do before do inputs.merge!( 'key(1i)' => :value1, 'key(2i)' => :value2 ) end it 'groups the inputs into a GroupedInput' do expect(result).to eq( key: ActiveInteraction::GroupedInput.new( '1' => :value1, '2' => :value2 ) ) end end context 'with a matching simple input' do before do inputs.merge!( 'key(1i)' => :value1, key: :value2 ) end it 'groups the inputs into a GroupedInput' do expect(result).to eq( key: ActiveInteraction::GroupedInput.new( '1' => :value1 ) ) end end end context 'with a reserved name' do before { inputs[:_interaction_key] = :value } it 'skips the input' do expect(result).to_not have_key(:_interaction_key) end end end end
25.705882
92
0.587643
62f2cb81a71b344ea5588f49f2290a2095e3d84d
1,020
# Copyright:: Copyright (c) 2015 Chef Software, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # These files create / add to the Delivery::DSL module require_relative 'helpers' # And these mix the DSL methods into the Chef infrastructure Chef::Recipe.send(:include, DeliverySugarExtras::DSL) Chef::Resource.send(:include, DeliverySugarExtras::DSL) Chef::Provider.send(:include, DeliverySugarExtras::DSL) Chef::Resource::RubyBlock.send(:include, DeliverySugarExtras::DSL)
40.8
74
0.767647
f765c8dcefbc1dbac3a78ba4edfc4bf9d8ae54a2
100
# frozen_string_literal: true module RgGen module PluginTemplate VERSION = '0.1.0' end end
12.5
29
0.72
264043cd0230b8cbf7bdf0ee3b5af045274796a6
144
require 'simplecov' SimpleCov.start RSpec.configure do |config| config.color = true end Dir['./spec/support/**/*.rb'].each { |f| require f }
18
52
0.6875
1cb94a6fa0f98f88bb7b9362d7ca04dd352ddec0
2,130
require 'active_support/core_ext/integer/time' # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is 'scratch space' for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Turn false under Spring and add config.action_view.cache_template_loading = true config.cache_classes = true # Eager loading loads your whole application. When running a single test locally, # this probably isn't necessary. It's a good idea to do in a continuous integration # system, or in some way before deploying your code. config.eager_load = ENV['CI'].present? # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr # Raise exceptions for disallowed deprecations. config.active_support.disallowed_deprecation = :raise # Tell Active Support which deprecation messages to disallow. config.active_support.disallowed_deprecation_warnings = [] # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true # Annotate rendered view with file names. # config.action_view.annotate_rendered_view_with_filenames = true config.action_mailer.delivery_method = :test config.action_mailer.default_url_options = { host: 'example.com' } end
38.035714
85
0.778873