mirror of https://github.com/apache/cloudstack.git
185 lines
8.7 KiB
Plaintext
185 lines
8.7 KiB
Plaintext
#Licensed to the Apache Software Foundation (ASF) under one
|
||
#or more contributor license agreements. See the NOTICE file
|
||
#distributed with this work for additional information
|
||
#regarding copyright ownership. The ASF licenses this file
|
||
#to you 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.
|
||
#
|
||
# Translators:
|
||
# Isaac Chiang <isaacchiang@gmail.com>, 2013.
|
||
msgid ""
|
||
msgstr ""
|
||
"Project-Id-Version: Apache CloudStack Docs\n"
|
||
"POT-Creation-Date: 2013-04-12T11:19:38\n"
|
||
"PO-Revision-Date: 2013-04-11 07:52+0000\n"
|
||
"Last-Translator: isaac.chiang <isaacchiang@gmail.com>\n"
|
||
"Language-Team: None\n"
|
||
"MIME-Version: 1.0\n"
|
||
"Content-Type: text/plain; charset=UTF-8\n"
|
||
"Content-Transfer-Encoding: 8bit\n"
|
||
"Language: zh_TW\n"
|
||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||
|
||
#. Tag: title
|
||
#, no-c-format
|
||
msgid "Examples"
|
||
msgstr "範例"
|
||
|
||
#. Tag: para
|
||
#, no-c-format
|
||
msgid ""
|
||
"There are many tools available to interface with a AWS compatible API. In "
|
||
"this section we provide a few examples that users of &PRODUCT; can build "
|
||
"upon."
|
||
msgstr "有很多tool支援使用AWS compatible API,此章節提供一些建構的範例"
|
||
|
||
#. Tag: title
|
||
#, no-c-format
|
||
msgid "Boto Examples"
|
||
msgstr "Boto 範例"
|
||
|
||
#. Tag: para
|
||
#, no-c-format
|
||
msgid ""
|
||
"Boto is one of them. It is a Python package available at "
|
||
"https://github.com/boto/boto. In this section we provide two examples of "
|
||
"Python scripts that use Boto and have been tested with the &PRODUCT; AWS API"
|
||
" Interface."
|
||
msgstr "Boto是一種Python package,可在https://github.com/boto/boto 取得。此章節提供兩個使用Boto的例子,已在&PRODUCT; AWS API Interface測試過"
|
||
|
||
#. Tag: para
|
||
#, no-c-format
|
||
msgid ""
|
||
"First is an EC2 example. Replace the Access and Secret Keys with your own "
|
||
"and update the endpoint."
|
||
msgstr "第一個為EC2範例,取代 Access and Secret Keys為您自己的,並更新終端"
|
||
|
||
#. Tag: title
|
||
#, no-c-format
|
||
msgid "An EC2 Boto example"
|
||
msgstr "EC2 Boto範例"
|
||
|
||
#. Tag: programlisting
|
||
#, no-c-format
|
||
msgid ""
|
||
"#!/usr/bin/env python\n"
|
||
"\n"
|
||
"import sys\n"
|
||
"import os\n"
|
||
"import boto\n"
|
||
"import boto.ec2\n"
|
||
"\n"
|
||
"region = boto.ec2.regioninfo.RegionInfo(name=\"ROOT\",endpoint=\"localhost\")\n"
|
||
"apikey='GwNnpUPrO6KgIdZu01z_ZhhZnKjtSdRwuYd4DvpzvFpyxGMvrzno2q05MB0ViBoFYtdqKd'\n"
|
||
"secretkey='t4eXLEYWw7chBhDlaKf38adCMSHx_wlds6JfSx3z9fSpSOm0AbP9Moj0oGIzy2LSC8iw'\n"
|
||
"\n"
|
||
"def main():\n"
|
||
"\t'''Establish connection to EC2 cloud'''\n"
|
||
" conn =boto.connect_ec2(aws_access_key_id=apikey,\n"
|
||
" aws_secret_access_key=secretkey,\n"
|
||
" is_secure=False,\n"
|
||
" region=region,\n"
|
||
" port=7080,\n"
|
||
" path=\"/awsapi\",\n"
|
||
" api_version=\"2010-11-15\")\n"
|
||
"\n"
|
||
" '''Get list of images that I own'''\n"
|
||
"\timages = conn.get_all_images()\n"
|
||
"\tprint images\n"
|
||
"\tmyimage = images[0]\n"
|
||
"\t'''Pick an instance type'''\n"
|
||
"\tvm_type='m1.small'\n"
|
||
"\treservation = myimage.run(instance_type=vm_type,security_groups=['default'])\n"
|
||
"\n"
|
||
"if __name__ == '__main__':\n"
|
||
"\tmain()\n"
|
||
" "
|
||
msgstr "#!/usr/bin/env python\n\nimport sys\nimport os\nimport boto\nimport boto.ec2\n\nregion = boto.ec2.regioninfo.RegionInfo(name=\"ROOT\",endpoint=\"localhost\")\napikey='GwNnpUPrO6KgIdZu01z_ZhhZnKjtSdRwuYd4DvpzvFpyxGMvrzno2q05MB0ViBoFYtdqKd'\nsecretkey='t4eXLEYWw7chBhDlaKf38adCMSHx_wlds6JfSx3z9fSpSOm0AbP9Moj0oGIzy2LSC8iw'\n\ndef main():\n\t'''Establish connection to EC2 cloud'''\n conn =boto.connect_ec2(aws_access_key_id=apikey,\n aws_secret_access_key=secretkey,\n is_secure=False,\n region=region,\n port=7080,\n path=\"/awsapi\",\n api_version=\"2010-11-15\")\n\n '''Get list of images that I own'''\n\timages = conn.get_all_images()\n\tprint images\n\tmyimage = images[0]\n\t'''Pick an instance type'''\n\tvm_type='m1.small'\n\treservation = myimage.run(instance_type=vm_type,security_groups=['default'])\n\nif __name__ == '__main__':\n\tmain()\n "
|
||
|
||
#. Tag: para
|
||
#, no-c-format
|
||
msgid ""
|
||
"Second is an S3 example. Replace the Access and Secret keys with your own, "
|
||
"as well as the endpoint of the service. Be sure to also update the file "
|
||
"paths to something that exists on your machine."
|
||
msgstr "第二個為S3範例,取代Access and Secret keys為您自己的,也取代終端的。確定更新檔案路徑到您機器上"
|
||
|
||
#. Tag: title
|
||
#, no-c-format
|
||
msgid "An S3 Boto Example"
|
||
msgstr "S3 Boto範例"
|
||
|
||
#. Tag: programlisting
|
||
#, no-c-format
|
||
msgid ""
|
||
"#!/usr/bin/env python\n"
|
||
"\n"
|
||
"import sys\n"
|
||
"import os\n"
|
||
"from boto.s3.key import Key\n"
|
||
"from boto.s3.connection import S3Connection\n"
|
||
"from boto.s3.connection import OrdinaryCallingFormat\n"
|
||
"\n"
|
||
"apikey='ChOw-pwdcCFy6fpeyv6kUaR0NnhzmG3tE7HLN2z3OB_s-ogF5HjZtN4rnzKnq2UjtnHeg_yLA5gOw'\n"
|
||
"secretkey='IMY8R7CJQiSGFk4cHwfXXN3DUFXz07cCiU80eM3MCmfLs7kusgyOfm0g9qzXRXhoAPCH-IRxXc3w'\n"
|
||
"\n"
|
||
"cf=OrdinaryCallingFormat()\n"
|
||
"\n"
|
||
"def main():\t\n"
|
||
"\t'''Establish connection to S3 service'''\n"
|
||
" conn =S3Connection(aws_access_key_id=apikey,aws_secret_access_key=secretkey, \\\n"
|
||
" is_secure=False, \\\n"
|
||
" host='localhost', \\\n"
|
||
" port=7080, \\\n"
|
||
" calling_format=cf, \\\n"
|
||
" path=\"/awsapi/rest/AmazonS3\")\n"
|
||
"\n"
|
||
" try:\n"
|
||
" bucket=conn.create_bucket('cloudstack')\n"
|
||
" k = Key(bucket)\n"
|
||
" k.key = 'test'\n"
|
||
" try:\n"
|
||
" k.set_contents_from_filename('/Users/runseb/Desktop/s3cs.py')\n"
|
||
" except:\n"
|
||
" print 'could not write file'\n"
|
||
" pass\n"
|
||
" except:\n"
|
||
" bucket = conn.get_bucket('cloudstack')\n"
|
||
" k = Key(bucket)\n"
|
||
" k.key = 'test'\n"
|
||
" try:\n"
|
||
" k.get_contents_to_filename('/Users/runseb/Desktop/foobar')\n"
|
||
" except:\n"
|
||
" print 'Could not get file'\n"
|
||
" pass\n"
|
||
"\n"
|
||
" try:\n"
|
||
" bucket1=conn.create_bucket('teststring')\n"
|
||
" k=Key(bucket1)\n"
|
||
" k.key('foobar')\n"
|
||
" k.set_contents_from_string('This is my silly test')\n"
|
||
" except:\n"
|
||
" bucket1=conn.get_bucket('teststring')\n"
|
||
" k = Key(bucket1)\n"
|
||
" k.key='foobar'\n"
|
||
" k.get_contents_as_string()\n"
|
||
"\t\n"
|
||
"if __name__ == '__main__':\n"
|
||
"\tmain()\n"
|
||
"\n"
|
||
" "
|
||
msgstr "#!/usr/bin/env python\n\nimport sys\nimport os\nfrom boto.s3.key import Key\nfrom boto.s3.connection import S3Connection\nfrom boto.s3.connection import OrdinaryCallingFormat\n\napikey='ChOw-pwdcCFy6fpeyv6kUaR0NnhzmG3tE7HLN2z3OB_s-ogF5HjZtN4rnzKnq2UjtnHeg_yLA5gOw'\nsecretkey='IMY8R7CJQiSGFk4cHwfXXN3DUFXz07cCiU80eM3MCmfLs7kusgyOfm0g9qzXRXhoAPCH-IRxXc3w'\n\ncf=OrdinaryCallingFormat()\n\ndef main():\t\n\t'''Establish connection to S3 service'''\n conn =S3Connection(aws_access_key_id=apikey,aws_secret_access_key=secretkey, \\\n is_secure=False, \\\n host='localhost', \\\n port=7080, \\\n calling_format=cf, \\\n path=\"/awsapi/rest/AmazonS3\")\n\n try:\n bucket=conn.create_bucket('cloudstack')\n k = Key(bucket)\n k.key = 'test'\n try:\n k.set_contents_from_filename('/Users/runseb/Desktop/s3cs.py')\n except:\n print 'could not write file'\n pass\n except:\n bucket = conn.get_bucket('cloudstack')\n k = Key(bucket)\n k.key = 'test'\n try:\n k.get_contents_to_filename('/Users/runseb/Desktop/foobar')\n except:\n print 'Could not get file'\n pass\n\n try:\n bucket1=conn.create_bucket('teststring')\n k=Key(bucket1)\n k.key('foobar')\n k.set_contents_from_string('This is my silly test')\n except:\n bucket1=conn.get_bucket('teststring')\n k = Key(bucket1)\n k.key='foobar'\n k.get_contents_as_string()\n\t\nif __name__ == '__main__':\n\tmain()\n\n "
|
||
|
||
#. Tag: title
|
||
#, no-c-format
|
||
msgid "JClouds Examples"
|
||
msgstr "JClouds範例"
|