s3-tools-0.08/COPYING0000644000000000000000000004310311153637251014326 0ustar00usergroup00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. s3-tools-0.08/COPYING.LESSER0000644000000000000000000006350411153637251015331 0ustar00usergroup00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! s3-tools-0.08/CREDITS0000644000000000000000000000011311153637251014305 0ustar00usergroup00000000000000Mark Atwood Brendan Leber s3-tools-0.08/Changes0000644000000000000000000000074411153637251014572 0ustar00usergroup00000000000000Revision history for Perl extension Net::Amazon::S3::Tools. 0.01 Thu Oct 11 16:02:39 2007 - original version; created by h2xs 1.23 with options -XAn Net::Amazon::S3::Tools 0.06 Fri Oct 12 01:15:00 2007 - MakeMaker configuration - merged via hg with s3-tools v0.05 - license LGPLv2.1 - many doc fixes 0.07 Mon Apr 28 14:28:14 PDT 2008 - remove dependecy on XML::Simple 0.08 Wed Feb 25 21:37:17 EST 2009 - add s3rm - convert to bzr and move to Launchpad s3-tools-0.08/MANIFEST0000644000000000000000000000025011153637251014420 0ustar00usergroup00000000000000Changes Makefile.PL MANIFEST README t/Net-Amazon-S3-Tools.t lib/Net/Amazon/S3/Tools.pm COPYING COPYING.LESSER CREDITS s3acl s3get s3ls s3mkbucket s3put s3rmbucket s3rm s3-tools-0.08/Makefile.PL0000644000000000000000000000146211153637251015247 0ustar00usergroup00000000000000use 5.008008; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Net::Amazon::S3::Tools', VERSION_FROM => 'lib/Net/Amazon/S3/Tools.pm', PREREQ_PM => { 'Pod::Usage' => 1, 'Getopt::Long' => 1, 'Getopt::ArgvFile' => 0, 'File::HomeDir' => 0, 'Net::Amazon::S3' => 0, 'Net::Amazon::S3::Bucket' => 0, # todo # Net::Amazon::S3 already uses XML::LibXML & XML::LibXML::XPathContext # so do rewrite to avoid need for XML::Writer 'XML::Writer' => 0, }, 'EXE_FILES' => [ 's3acl', 's3ls', 's3get', 's3put', 's3rm', 's3mkbucket', 's3rmbucket' ], ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT => 'Command line tools for Amazon AWS S3', AUTHOR => 'Mark Atwood ') : ()), ); s3-tools-0.08/README0000644000000000000000000000316411153637251014156 0ustar00usergroup00000000000000Net-Amazon-S3-Tools version 0.01 ================================ Command line tools for Amazon AWS S3 INSTALLATION To install this module type the following: perl Makefile.PL make make test make install DEPENDENCIES - Pod::Usage - Getopt::Long - Getopt::ArgvFile - File::HomeDir - Net::Amazon::S3 - Net::Amazon::S3::Bucket - XML::Writer - You must have an Amazon Web Service (AWS) account with the Simple Storage Service (S3) enabled. - You will need your "AWS Access Key ID" and your "AWS Secret Access Key" for that account. COPYRIGHT AND LICENSE Copyright (C) 2007,2008,2009 by Mark Atwood Many thanks to Wotan LLC , for supporting the development of these S3 tools. This module is not an official Amazon product or service. Information used to create this module was obtained only from publicly available information, mainly from the published Amazon documentation. This module is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 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 and the GNU Lesser General Public License along with this program. If not, see . s3-tools-0.08/lib/0000755000000000000000000000000011153637251014040 5ustar00usergroup00000000000000s3-tools-0.08/lib/Net/0000755000000000000000000000000011153637251014566 5ustar00usergroup00000000000000s3-tools-0.08/lib/Net/Amazon/0000755000000000000000000000000011153637251016013 5ustar00usergroup00000000000000s3-tools-0.08/lib/Net/Amazon/S3/0000755000000000000000000000000011153637251016300 5ustar00usergroup00000000000000s3-tools-0.08/lib/Net/Amazon/S3/Tools.pm0000644000000000000000000001033211153637251017735 0ustar00usergroup00000000000000package Net::Amazon::S3::Tools; use 5.008008; use strict; use warnings; require Exporter; our @ISA = qw(Exporter); # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. # This allows declaration use Net::Amazon::S3::Tools ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( ); our $VERSION = '0.07'; # Preloaded methods go here. 1; __END__ =head1 NAME Net::Amazon::S3::Tools - command line tools for Amazon S3 =head1 SYNOPSIS s3acl [options] [[bucket|bucket/key] ...] s3ls [options] s3ls [options] [ bucket/item ... ] s3get [options] [ bucket/item ... ] s3put [options] [ bucket/item ... ] s3mkbucket [options] [ bucket ... ] s3rmbucket [options] [ bucket ... ] =head1 OPTIONS Each of the tools have their own specific command line options, but the also all share some common command line options, which are described here. =item B<--help> Print a brief help message and exits. =item B<--man> Prints the manual page and exits. =item B<--verbose> Output what is being done as it is done. =item B<--access-key> and B<--secret-key> Specify the "AWS Access Key Identifiers" for the AWS account. B<--access-key> is the "Access Key ID", and B<--secret-key> is the "Secret Access Key". These are effectively the "username" and "password" to the AWS account, and should be kept confidential. The access keys MUST be specified, either via these command line parameters, or via the B and B environment variables. Specifying them on the command line overrides the environment variables. =item B<--secure> Uses SSL/TLS HTTPS to communicate with the AWS service, instead of HTTP. =head1 DESCRIPTION These S3 command line tools allow you to manipulate and populate an S3 account. Refer to the documentation (pod and man) for each of the tools. This L module is mostly just a stub, to hoist the bundling and installation of the executable scripts that make up the actual tools. =head1 BUGS Report bugs to Mark Atwood L. Occasionally the S3 service will randomly fail for no externally apparent reason. When that happens, these tools should retry, with a delay and a backoff. Access to the S3 service can be authenticated with a X.509 certificate, instead of via the "AWS Access Key Identifiers". These tools should support that. It might be useful to be able to specify the "AWS Access Key Identifiers" in the user's C<~/.netrc> file. These tools should support that. Errors and warnings are very "Perl-ish", and can be confusing. =head1 SEE ALSO These tools use the L Perl module. The Amazon Simple Storage Service is documented at L. These tools are hosted at L. =head1 AUTHOR Written by Mark Atwood L. Many thanks to Wotan LLC L, for supporting the development of these S3 tools. Many thanks to the Amazon AWS engineers for developing S3. =head1 COPYRIGHT AND LICENSE Copyright (C) 2007,2008 by Mark Atwood This module is not an official Amazon product or service. Information used to create this module was obtained only from publicly available information, mainly from the published Amazon documentation. This module is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 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 and the GNU Lesser General Public License along with this program. If not, see . =cut s3-tools-0.08/s3acl0000755000000000000000000006243011153637251014232 0ustar00usergroup00000000000000#!/usr/local/bin/perl # Copyright (C) 2007,2008 by Mark Atwood . # # This module is not an official Amazon product or service. Information # used to create this module was obtained only from publicly available # information, mainly from the published Amazon documentation. # # This module is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 2.1 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 # and the GNU Lesser General Public License along with this program. # If not, see . use warnings; use strict; use Getopt::Long; use Pod::Usage; use Net::Amazon::S3; use Net::Amazon::S3::Bucket; use XML::Writer; use XML::LibXML; use Getopt::ArgvFile qw/argvFile/; use File::HomeDir; my $aws_access_key_id = $ENV{AWS_ACCESS_KEY_ID}; my $aws_secret_access_key = $ENV{AWS_ACCESS_KEY_SECRET}; my $opt_verbose =0; my $opt_help =0; my $opt_man =0; my $opt_secure =0; my $opt_xml =0; my $opt_get =0; my $opt_set =0; my $opt_clear =0; my $opt_add =0; my $opt_del =0; my $opt_canned =0; # get the options from the users ~/.s3-tools file, if it exists my $users_config = File::HomeDir->my_home() . '/.s3-tools'; if (-e $users_config) { unshift @ARGV, '@' . $users_config; } argvFile(); GetOptions('help|?' => \$opt_help, 'man' => \$opt_man, 'verbose+' => \$opt_verbose, 'access-key=s' => \$aws_access_key_id, 'secret-key=s' => \$aws_secret_access_key, 'secure' => \$opt_secure, 'xml' => \$opt_xml, 'get' => \$opt_get, 'set' => \$opt_set, 'clear' => \$opt_clear, 'add=s' => \$opt_add, 'del=s' => \$opt_del, 'acl-short=s' => \$opt_canned, ) or pod2usage(2); pod2usage(1) if $opt_help; pod2usage(-exitstatus => 0, -verbose => 2) if $opt_man; use constant AMZN_GROUP_USERS => 'http://acs.amazonaws.com/groups/global/AuthenticatedUsers'; use constant AMZN_GROUP_WORLD => 'http://acs.amazonaws.com/groups/global/AllUsers'; my $s3p = { aws_access_key_id => $aws_access_key_id, aws_secret_access_key => $aws_secret_access_key }; $s3p->{secure} = $opt_secure if ($opt_secure); my $s3 = Net::Amazon::S3->new($s3p); ($s3) or die("$0: fail Net::Amazon::S3: $!, stopped"); my $bkts = make_bucketlist(); if ($opt_get) { foreach my $b (@{$bkts}) { my $x = get_xmlacl($b); unless ($x) { printf STDERR "cant get acl of %s: %s", $b->{arg}, $b->{err}; next; } if ($opt_xml) { print $x, "\n"; } else { my $r = parse_xmlacl($x, $b->{bucketname}, $b->{itemkey}); print_acl($r); } } } elsif ($opt_set) { if ($opt_canned) { foreach my $b (@{$bkts}) { put_cannedacl($b, $opt_canned); } } elsif ($opt_xml) { my $x; # read the xml acl from stdin { local $/; # Set input to "slurp" mode. $x = ; } # blindly assume that is a correct XML ACL # apply it to each thing foreach my $b (@{$bkts}) { put_xmlacl($b, $x); } } else { foreach my $b (@{$bkts}) { # get the current acl my $x = get_xmlacl($b); unless ($x) { printf STDERR "fail %s: %s", $b->{arg}, $b->{err}; next; } # parse it my $r = parse_xmlacl($x, $b->{bucketname}, $b->{itemkey}); # process opt_clear if ($opt_clear) { $r->{Grant} = []; } # process opt_del if ($opt_del) { foreach (split(',', $opt_del)) { my($asu, $asp) = split(':', $_, 2); next unless ($asu && $asp); foreach my $gr (@{$r->{Grant}}) { if ((($asu eq "ANY") || (($asu eq "OWNER") && ($gr->{ID} eq $r->{Owner}->{ID})) || (($asu eq "USERS") && ($gr->{URI} eq AMZN_GROUP_USERS)) || (($asu eq "WORLD") && ($gr->{URI} eq AMZN_GROUP_WORLD)) || (($asu =~ m/^\<(.*)\>$/) && ($gr->{URI} eq $1)) || ($asu eq $gr->{ID})) && (($asp eq "ANY") || ($asp eq $gr->{Permission}))) { # rather than mutate the @{$r->{Grant}} list, # put in a "deleted" marker, and then skip # this grant when coverting back to XML $gr->{deleted} = 1; } } } } # process opt_add if ($opt_add) { foreach (split(',', $opt_add)) { my($asu, $asp) = split(':', $_, 2); next unless ($asu && $asp); my $gr; # the grant we will build and then add if ($asu eq "OWNER") { $gr = { type => 'CanonicalUser', ID => $r->{Owner}->{ID}, Permission => $asp }; } elsif ($asu eq "USERS") { $gr = { type => 'Group', URI => AMZN_GROUP_USERS, Permission => $asp }; } elsif ($asu eq "WORLD") { $gr = { type => 'Group', URI => AMZN_GROUP_WORLD, Permission => $asp }; } elsif ($asu =~ m/^\<(.*)\>$/) { $gr = { type => 'Group', URI => $1, Permission => $asp }; } elsif ($asu =~ m/\@/) { $gr = { type => 'AmazonCustomerByEmail', EmailAddress => $asu, Permission => $asp }; } else { $gr = { type => 'CanonicalUser', ID => $asu, Permission => $asp }; } push(@{$r->{Grant}}, $gr); } } # convert the acl back to xml my $xn = gen_xmlacl($r); # apply it to the thing put_xmlacl($b, $xn); } } } sub make_bucketlist { my @B; my ($bn, $ik, $b); foreach my $arg (@ARGV) { $b = undef; $b->{arg} = $arg; ($bn, $ik) = split('/', $arg, 2); $b->{bucketname} = $bn; $b->{itemkey} = $ik if ($ik); $b->{bucketobject} = $s3->bucket($bn); push @B, $b; } return \@B; } sub put_cannedacl { my $b = shift; my $a = shift; my $rv; my $p = { acl_short => $a }; if ($b->{itemkey}) { $p->{key} = $b->{itemkey}; } eval { $rv = $b->{bucketobject}->set_acl($p); }; if ($@) { $b->{err} = $@; return undef; } elsif (!$rv && !defined($b->{err})) { $b->{err} = "fail set_acl"; } return $rv; } sub put_xmlacl { my $b = shift; my $x = shift; my $rv; my $p = { acl_xml => $x }; if ($b->{itemkey}) { $p->{key} = $b->{itemkey}; } eval { $rv = $b->{bucketobject}->set_acl($p); }; if ($@) { $b->{err} = $@; return undef; } elsif (!$rv && !defined($b->{err})) { $b->{err} = "fail set_acl"; } return $rv; } sub get_xmlacl { my $b = shift; my $x; eval { $x = $b->{bucketobject}->get_acl($b->{itemkey}); }; if ($@) { $b->{err} = $@; return undef; } elsif (!$x && !defined($b->{err})) { $b->{err} = "fail get_acl"; } return $x; } sub parse_xmlacl { my $xml_acl_raw = shift; my $bucket_name = shift; my $item_name = shift; my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($xml_acl_raw); my $xpc = XML::LibXML::XPathContext->new($doc); $xpc->registerNs('s3', 'http://s3.amazonaws.com/doc/2006-03-01/'); $xpc->registerNs('xsi', 'http://www.w3.org/2001/XMLSchema-instance'); my $r; $r->{bucket} = $bucket_name; $r->{item} = $item_name if ($item_name); $r->{Owner}->{ID} = $xpc->findvalue("/s3:AccessControlPolicy/s3:Owner/s3:ID"); $r->{Owner}->{DisplayName} = $xpc->findvalue("/s3:AccessControlPolicy/s3:Owner/s3:DisplayName"); $r->{Grant} = []; foreach my $xg ($xpc->findnodes("/s3:AccessControlPolicy/s3:AccessControlList/s3:Grant")) { my $g; $g->{type}= $xpc->find('./s3:Grantee/@xsi:type', $xg)->to_literal(); if ($g->{type} eq 'CanonicalUser') { $g->{ID} = $xpc->find('./s3:Grantee/s3:ID', $xg)->to_literal(); $g->{DisplayName} = $xpc->find('./s3:Grantee/s3:DisplayName', $xg)->to_literal(); } elsif ($g->{type} eq 'Group') { $g->{URI} = $xpc->find('./s3:Grantee/s3:URI', $xg)->to_literal(); } elsif ($g->{type} eq 'AmazonCustomerByEmail') { $g->{EmailAddress} = $xpc->find('./s3:Grantee/s3:EmailAddress', $xg)->to_literal(); } else { # unknown type } $g->{Permission} = $xpc->find("./s3:Permission", $xg)->to_literal(); push(@{$r->{Grant}}, $g); } return $r; } sub parse_grant { my $g = shift; my $r; $r->{'type'} = $g->{Grantee}->{'xsi:type'}; foreach ("URI", "ID", "DisplayName", "EmailAddress") { if ($g->{Grantee}->{$_}) { $r->{$_} = $g->{Grantee}->{$_}; } } $r->{Permission} = $g->{Permission}; return $r; } sub print_acl { my $a = shift; print "# bucket: ", $a->{bucket}, "\n"; print "# item: ", $a->{item}, "\n" if $a->{item}; print "# owner: ", $a->{Owner}->{ID}, "\n"; foreach my $g (@{$a->{Grant}}) { print str_grant($g, $a->{Owner}->{ID}), "\n"; } } sub gen_xmlacl { my $a = shift; my $x; my $w = XML::Writer->new(OUTPUT => \$x); $w->xmlDecl("UTF-8"); $w->startTag('AccessControlPolicy', 'xmlns' => "http://s3.amazonaws.com/doc/2006-03-01/"); $w->startTag('Owner'); $w->dataElement('ID', $a->{Owner}->{ID}); $w->dataElement('DisplayName', $a->{Owner}->{DisplayName}); $w->endTag(); # Owner $w->startTag('AccessControlList'); foreach my $g (@{$a->{Grant}}) { next if $g->{deleted}; $w->startTag('Grant'); $w->startTag('Grantee', 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance", 'xsi:type' => $g->{type}); foreach ("URI", "ID", "DisplayName", "EmailAddress") { if ($g->{$_}) { $w->dataElement($_, $g->{$_}); } } $w->endTag(); # Grantee $w->dataElement('Permission', $g->{Permission}); $w->endTag(); # Grant } $w->endTag(); # AccessControlList $w->endTag(); # AccessControlPolicy $w->end(); return $x; } sub str_grant { my $g = shift; my $owner = shift; my $s = ""; if ($g->{type} eq "CanonicalUser") { if ($g->{ID} eq $owner) { $s .= "OWNER"; } else { $s .= $g->{ID}; } } elsif ($g->{type} eq "Group") { if ($g->{URI} eq AMZN_GROUP_WORLD) { $s .= "WORLD"; } elsif ($g->{URI} eq AMZN_GROUP_USERS) { $s .= "USERS"; } else { $s .= '<' . $g->{URI} . '>'; } } elsif ($g->{type} eq "AmazonCustomerByEmail") { $s .= $g->{EmailAddress}; } else { $s .= '[UNKNOWN GRANTEE TYPE:' . $g->{type} . ']'; } $s .= ':' . $g->{Permission}; return $s; } __END__ =head1 NAME s3acl - Display or manipulate the ACL of AWS S3 buckets and items =head1 SYNOPSIS s3acl [options] [[bucket|bucket/key] ...] Options: --access-key AWS Access Key ID --secret-key AWS Secret Access Key --get Output the ACL to STDOUT --xml in raw XML form instead of parsed form --set Modify the ACL --clear remove all grants from the ACL --add grant,grant,... add grants to the ACL --del grant,grant,... remove matching grants from the ACL --xml apply the XML ACL from STDIN to the item --acl-short cannedacl apply the "canned" ACL to the item Environment: AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_SECRET =head1 OPTIONS =over 8 =item B<--help> Print a brief help message and exits. =item B<--man> Prints the manual page and exits. =item B<--verbose> Output what is being done as it is done. =item B<--access-key> and B<--secret-key> Specify the "AWS Access Key Identifiers" for the AWS account. B<--access-key> is the "Access Key ID", and B<--secret-key> is the "Secret Access Key". These are effectively the "username" and "password" to the AWS account, and should be kept confidential. The access keys MUST be specified, either via these command line parameters, or via the B and B environment variables. Specifying them on the command line overrides the environment variables. =item B<--secure> Uses SSL/TLS HTTPS to communicate with the AWS service, instead of HTTP. =item B<--get> Retreive and display the ACL for each specified bucket or item. =item B<--xml> When used with the B<--get> option, outputs to stdout the raw XML, instead of parsed format. This raw XML is documented in the "Amazon S3 Developer Guide". If more than one bucket or item is specified, the XML ACL for each will be output, concatenated together. This is probably not very useful. The raw XML output can be used as input for the B<--set> option, like so: s3acl --get --xml bucketA | s3acl --set --xml bucketB bucketC This does not work when specifying more than one bucket or item to the B<--get> option, because the concatenation of multiple XML ACLs is not a valid XML ACL. =item B<--set> Instead of displaying the ACL, modify it. An ACL can be modified by using B<--clear>, B<--add>, and B<--del>, or by using B<--xml>, or by using B<--acl-short>. =item B<--clear> Removes all of the grants from the ACL. This includes access by the owner of the bucket or item. This is done before the B<--add> or B<--del> options are applied, no matter what order options are specified on the command line. It is usually accompanied by the B<--add> option to add some grants back to the now empty ACL. =item B<--del> Remove matching grants from the ACL. This is done before the B<--add> option is applied, no matter what order options are specified on the command line. Grants are specified in parsed form, and then joined together by commas with no whitespace. There is an extention to the parsed grant format. If the grantee is specified as "ANY", then it matches any and all grantees in the ACL. If the permission is specified as "ANY", then it matches any permission. Thus s3acl --set --del ANY:READ mybucket removes all grants that give READ permission, and s3acl --set --del someuserid:ANY mybucket removes all grants to the user someuserid s3acl --set --del ANY:ANY mybucket does the same thing as s3acl --set --clear mybucket Due to a limitation in the semantics of the S3 API, it is not possible to delete a grantee by email address, only by canonical ID. =item B<--add> Add the specified grants to the ACL. Grants are specified in parsed form, and then joined together by commas with no whitespace. It is possible to add the same grant to a bucket or item more than once. This is a surprising behavior of the S3 service. =item B<--xml> When used with B<--set>, and instead of using <--clear>, <--del>, and B<--add>, read a raw XML ACL from STDIN, and then apply it to each given bucket or item. This will completely overwrite the existing ACL for each given bucket or item. =item B<--acl-short> Instead of using <--clear>, <--del>, and B<--add>, or using <--xml>, apply a "canned ACL" to each given bucket or item. This will completely overwrite the existing ACL for each given bucket or item. The following canned ACLs are currently defined by S3: =over 8 =item B Owner gets C. No one else has any access rights. This is the default for newly created buckets and items. =item B Owner gets C. The anonymous principal is granted C access. =item B Owner gets C. The anonymous principal is granted C and C access. This is a useful policy to apply to a bucket, if you intend for any anonymous user to PUT objects into the bucket. =item B Owner gets C . Any principal authenticated as a registered Amazon S3 user is granted C access. =back =item B or B One or more bucket names or bucket and key names, specifies an item. As many as possible will be be processed. If just a bucket name is given, the ACL for that bucket is retreived or modified. If a bucket name and a key, seperated by a slash, is given, the ACL for that key in that bucket is retreived or modified. If a bucket name begins with one or more dashes, it might be mistaken for a command line option. If this is the case, separate the command line options from the bucket or bucket/key names with two dashes, like so: s3acl --get -- --bucketname/keyname =back =head1 ENVIRONMENT VARIABLES =over 8 =item B and B Specify the "AWS Access Key Identifiers" for the AWS account. B contains the "Access Key ID", and B contains the "Secret Access Key". These are effectively the "username" and "password" to the AWS service, and should be kept confidential. The access keys MUST be specified, either via these environment variables, or via the B<--access-key> and B<--secret-key> command line parameters. If the command line parameters are set, they override these environment variables. =back =head1 CONFIGURATION FILE The configuration options will be read from the file C<~/.s3-tools> if it exists. The format is the same as the command line options with one option per line. For example, the file could contain: --access-key --secret-key --secure This example configuration file would specify the AWS access keys and that a secure connection using HTTPS should be used for all communications. =head1 DESCRIPTION Retrieves and outputs the Access Control List (ACL) of buckets and of items in buckets in the Amazon Simple Storage Service (S3). =head2 Principals (Much of the following text is taken from the "Amazon S3 Developer Guide (API Version 2006-03-01)".) Every bucket and item has an Access Control List (ACL). When a request is made, S3 determines the principal making the request, and then checks the access control list to see if that principal is authorized to make the request. If the ACL contains an entry authorizing that principal to make this request, the request is allowed to proceed, otherwise an error is returned. A principal may be someone with an AWS S3 account who has logged in, or "authenticated". The principal might be the creator and owner of the bucket or item. Or the principal might be some anonymous web browser out on the internet. =head2 ACL is sequence of grants. A grant is 1 grantee and 1 permission. An access control list is a sequence of grants. It may contain up to 100 grants. A grant is composed of one grantee, which is a description of the principal who will be allowed access, and one permission, which is a description of what that principal is allowed to do with that bucket or item. =head2 User Grantee A user grantee must be registered as an Amazon.com customer, but does not have to be registered as an AWS customer. When an ACL is read, the user grantee will be displayed in a canonical format, which consists of 64 hex characters. The exception is if the grantee is the owner. Amazon still stores and returns the grantee in canonical form, but this tool displays it as "OWNER". =head2 Group Grantee The only groups available are those pre-defined by S3. In the current release of S3, you cannot create your own group. There are currently two pre-defined groups. The first is represented by the string "WORLD" by this tool. All principals, whether they are anonymous or authenticated, are considered part of this group. The second is represented by the string "USERS" by this tool. Every non-anonymous principal is considered part of the group. Note that permission granted by virtue of this grant does not trump other access control considerations. For example, if a user is registered with AWS, they may be part of this group, but if they have not subscribed to S3, they will still not be granted access. There is also a special pseudo group with the string "ANY". It is used by the B<--del> option to match against a ACL item to select for deletion. If Amazon updates S3 to define any additional groups before this tool is updated, they will be represented as a URI surrounded by angle brackets. =head2 Owner Every bucket and item in S3 has an owner attribute associated with it. The owner the user that created the bucket or item. The only way to change the owner of a bucket is to delete the bucket and create it again under a different user identity. The only way to change the owner of an item is to overwrite the item using a different identity. The owner of a bucket or item is subject to the access control policy of that bucket or item just like everybody else, with two notable exceptions: The owner of a resource always has the ability to read and write the ACL of that resource, no matter what the associated ACL says. For example, as the owner of an item, you could remove yourself from the associated access control list, and find that you can no longer read the item's data and metadata. However, by virtue of being owner, you always have the right to re-grant yourself permissions to it. This policy prevents the situation where an item becomes "stranded," with nobody able to ever modify or even delete it. =head2 Permissions The permission in a grant describes the type of access to be granted to the respective grantee. The following permissions are supported: =over 8 =item READ When applied to a bucket, this grants permission to list the bucket. When applied to an item, this grants permission to read the item data and/or metadata. =item WRITE When applied to a bucket, this grants permission to create, overwrite, and delete any item in the bucket. This permission is not supported for items (it is reserved for future use). =item READ_ACP Grants permission to read the access control policy (ACL and owner) for the applicable bucket or item. The owner of a bucket or item always has this permission implicitly. =item WRITE_ACP Grants permission to overwrite the ACP for the applicable bucket or item. The owner of a bucket or item always has this permission implicitly. Note that granting this permission is equivalent to granting FULL_CONTROL, because the grant recipient can now make any whatever changes to the ACP he or she likes! =item FULL_CONTROL This permission is short-hand for the union of READ, WRITE, READ_ACP, and WRITE_ACP permissions. It does not convey additional rights, and is provided only for convenience. It is probably unwise to give this permission to WORLD. =item ANY This is not really a permission, but is used by the B<--del> option. It matches any permission to select a grant for deletion. =back =head2 Default ACL If no ACL is provided at the time a bucket is created or an item written then a default ACL is created. The default ACL for new resources consists of a single grant that gives the owner of the resource (i.e. the principal making the request to create the bucket or to write the item) FULL_CONTROL permission. Note that if you overwrite an existing item, the ACL for the existing item is always overwritten as well, and defaulted back to OWNER:FULL_CONTROL if no explicit ACL is provided. =head2 Raw XML ACL Format The XML ACL format is documented in the "Amazon S3 Developer Guide". =head2 Parsed ACL Format This tool parses the raw XML ACL format into a more readable form. A parsed ACL consists of several lines. Comments are lines that begin with a hash character. Lines that are not comments are grants. For buckets, the comments give the bucket name, and the Amazon canonical user string for the owner. For items, the comments give the bucket name, the item key, and the Amazon canonical user string for the owner. A grant is grantee string and a permission string, seperated with a colon character. A grantee can be one of the strings "OWNER", "WORLD", or "USERS", or a URI wrapped in angle brackets, or the email address of an Amazon user, or a Amazon canonical user string, which is 64 hex characters. A permission is one of the strings "READ", "WRITE", "READ_ACP", "WRITE_ACP", or "FULL_CONTROL". $ ./s3getacl example # bucket: example # owner: 5a1568e09392dad4b4ceb54f29f0a64d651a531350d6f720fbd2367eed995f08 OWNER:FULL_CONTROL a00490decea9d0ad76e5ef8b450b3efa63861adccfb9197cfb42f837eb222df2:WRITE USERS:READ WORLD:READ $ ./s3getacl example/thingee # bucket: example # item: thingee # owner: 5a1568e09392dad4b4ceb54f29f0a64d651a531350d6f720fbd2367eed995f08 OWNER:FULL_CONTROL $ _ =head1 BUGS Report bugs to Mark Atwood L. Occasionally the S3 service will randomly fail for no externally apparent reason. When that happens, this tool should retry, with a delay and a backoff. Access to the S3 service can be authenticated with a X.509 certificate, instead of via the "AWS Access Key Identifiers". This tool should support that. It might be useful to be able to specify the "AWS Access Key Identifiers" in the user's C<~/.netrc> file. This tool should support that. Errors and warnings are very "Perl-ish", and can be confusing. Trying to access a bucket or item that does not exist or is not accessable by the user generates less than helpful error messages. L already uses L and L, so this tool should use those instead of using L, to have fewer module dependences. It is possible to add the same grant to a bucket or item more than once. This is a surprising behavior of the S3 service. Both identical grants will be removed by using the B<--del> option. Due to a limitation in the semantics of the S3 API, it is not possible to delete a grantee by email address, only by canonical ID. =head1 AUTHOR Written by Mark Atwood L. Many thanks to Wotan LLC L, for supporting the development of these S3 tools. Many thanks to the Amazon AWS engineers for developing S3. =head1 SEE ALSO These tools use the L Perl module. The Amazon Simple Storage Service (S3) is documented at L. =cut s3-tools-0.08/s3get0000755000000000000000000001412011153637251014243 0ustar00usergroup00000000000000#!/usr/local/bin/perl # Copyright (C) 2007 by Mark Atwood . # # This module is not an official Amazon product or service. Information # used to create this module was obtained only from publicly available # information, mainly from the published Amazon documentation. # # This module is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 2.1 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 # and the GNU Lesser General Public License along with this program. # If not, see . use warnings; use strict; use Getopt::Long; use Pod::Usage; use Net::Amazon::S3; use Net::Amazon::S3::Bucket; use Getopt::ArgvFile qw/argvFile/; use File::HomeDir; my $aws_access_key_id = $ENV{AWS_ACCESS_KEY_ID}; my $aws_secret_access_key = $ENV{AWS_ACCESS_KEY_SECRET}; my $opt_verbose =0; my $opt_help =0; my $opt_man =0; my $opt_secure =0; # get the options from the users ~/.s3-tools file, if it exists my $users_config = File::HomeDir->my_home() . '/.s3-tools'; if (-e $users_config) { unshift @ARGV, '@' . $users_config; } argvFile(); GetOptions('help|?' => \$opt_help, 'man' => \$opt_man, 'verbose+' => \$opt_verbose, 'access-key=s' => \$aws_access_key_id, 'secret-key=s' => \$aws_secret_access_key, 'secure' => \$opt_secure, ) or pod2usage(2); pod2usage(1) if $opt_help; pod2usage(-exitstatus => 0, -verbose => 2) if $opt_man; my $s3p = { aws_access_key_id => $aws_access_key_id, aws_secret_access_key => $aws_secret_access_key }; $s3p->{secure} = $opt_secure if ($opt_secure); my $s3 = Net::Amazon::S3->new($s3p); ($s3) or die("$0: fail Net::Amazon::S3: $!, stopped"); my $bkts = make_bucketlist(); foreach my $b (@{$bkts}) { next unless $b->{itemkey}; print $b->{bucketobject}->get_key($b->{itemkey})->{value}; } sub make_bucketlist { my @B; my ($bn, $ik, $b); foreach my $arg (@ARGV) { $b = undef; $b->{arg} = $arg; ($bn, $ik) = split('/', $arg, 2); $b->{bucketname} = $bn; $b->{itemkey} = $ik if ($ik); $b->{bucketobject} = $s3->bucket($bn); push @B, $b; } return \@B; } __END__ =head1 NAME s3get - Retrieve contents of S3 items =head1 SYNOPSIS s3get [options] s3get [options] [ bucket/item ...] Options: --access-key AWS Access Key ID --secret-key AWS Secret Access Key Environment: AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_SECRET =head1 OPTIONS =over 8 =item B<--help> Print a brief help message and exits. =item B<--man> Prints the manual page and exits. =item B<--verbose> Output what is being done as it is done. =item B<--access-key> and B<--secret-key> Specify the "AWS Access Key Identifiers" for the AWS account. B<--access-key> is the "Access Key ID", and B<--secret-key> is the "Secret Access Key". These are effectively the "username" and "password" to the AWS account, and should be kept confidential. The access keys MUST be specified, either via these command line parameters, or via the B and B environment variables. Specifying them on the command line overrides the environment variables. =item B<--secure> Uses SSL/TLS HTTPS to communicate with the AWS service, instead of HTTP. =back =head1 ENVIRONMENT VARIABLES =over 8 =item B and B Specify the "AWS Access Key Identifiers" for the AWS account. B contains the "Access Key ID", and B contains the "Secret Access Key". These are effectively the "username" and "password" to the AWS service, and should be kept confidential. The access keys MUST be specified, either via these environment variables, or via the B<--access-key> and B<--secret-key> command line parameters. If the command line parameters are set, they override these environment variables. =back =head1 CONFIGURATION FILE The configuration options will be read from the file C<~/.s3-tools> if it exists. The format is the same as the command line options with one option per line. For example, the file could contain: --access-key --secret-key --secure This example configuration file would specify the AWS access keys and that a secure connection using HTTPS should be used for all communications. =head1 DESCRIPTION Retrieves S3 items, and outputs them to stdout. =head1 BUGS Report bugs to Mark Atwood L. Occasionally the S3 service will randomly fail for no externally apparent reason. When that happens, this tool should retry, with a delay and a backoff. Access to the S3 service can be authenticated with a X.509 certificate, instead of via the "AWS Access Key Identifiers". This tool should support that. It might be useful to be able to specify the "AWS Access Key Identifiers" in the user's C<~/.netrc> file. This tool should support that. Errors and warnings are very "Perl-ish", and can be confusing. Trying to access an item that does not exist or is not accessable by the user generates less than helpful error messages. Trying to retrieve a bucket instead of an item is silently skipped. =head1 TODO option to write to files instead of stdout option to write to paths instead of stdout option to write to a tar file stream, for multiple items option to write extended file attributes based on S3 & HTTP metadata option to have a progress bar =head1 AUTHOR Written by Mark Atwood L. Many thanks to Wotan LLC L, for supporting the development of these S3 tools. Many thanks to the Amazon AWS engineers for developing S3. =head1 SEE ALSO These tools use the L Perl module. The Amazon Simple Storage Service (S3) is documented at L. =cut s3-tools-0.08/s3ls0000755000000000000000000002206111153637251014105 0ustar00usergroup00000000000000#!/usr/local/bin/perl # Copyright (C) 2007 by Mark Atwood . # # This module is not an official Amazon product or service. Information # used to create this module was obtained only from publicly available # information, mainly from the published Amazon documentation. # # This module is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 2.1 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 # and the GNU Lesser General Public License along with this program. # If not, see . use warnings; use strict; use Getopt::Long; use Pod::Usage; use Net::Amazon::S3; use Net::Amazon::S3::Bucket; use Getopt::ArgvFile qw/argvFile/; use File::HomeDir; my $aws_access_key_id = $ENV{AWS_ACCESS_KEY_ID}; my $aws_secret_access_key = $ENV{AWS_ACCESS_KEY_SECRET}; my $opt_verbose =0; my $opt_help =0; my $opt_man =0; my $opt_secure =0; my $opt_long =0; # get the options from the users ~/.s3-tools file, if it exists my $users_config = File::HomeDir->my_home() . '/.s3-tools'; if (-e $users_config) { unshift @ARGV, '@' . $users_config; } argvFile(); GetOptions('help|?' => \$opt_help, 'man' => \$opt_man, 'verbose+' => \$opt_verbose, 'access-key=s' => \$aws_access_key_id, 'secret-key=s' => \$aws_secret_access_key, 'secure' => \$opt_secure, 'long' => \$opt_long, ) or pod2usage(2); pod2usage(1) if $opt_help; pod2usage(-exitstatus => 0, -verbose => 2) if $opt_man; my $s3p = { aws_access_key_id => $aws_access_key_id, aws_secret_access_key => $aws_secret_access_key }; $s3p->{secure} = $opt_secure if ($opt_secure); my $s3 = Net::Amazon::S3->new($s3p); ($s3) or die("$0: fail Net::Amazon::S3: $!, stopped"); my $bkts = make_bucketlist(); if (@{$bkts}) { foreach my $b (@{$bkts}) { if ($b->{itemkey}) { list_item($s3, $b, $opt_long); } else { list_bucket($s3, $b, $opt_long); } } } else { # if no buckets or items were specified list_all_buckets($s3, $opt_long); } sub make_bucketlist { my @B; my ($bn, $ik, $b); foreach my $arg (@ARGV) { $b = undef; $b->{arg} = $arg; ($bn, $ik) = split('/', $arg, 2); $b->{bucketname} = $bn; $b->{itemkey} = $ik if ($ik); $b->{bucketobject} = $s3->bucket($bn); push @B, $b; } return \@B; } sub list_all_buckets { my $s3 = shift; my $opt_long = shift; if ($opt_long) { foreach $b (@{$s3->buckets()->{buckets}}) { print $b->{creation_date}, "\t", $b->{bucket}, "\n"; } } else { foreach $b (@{$s3->buckets()->{buckets}}) { print $b->{bucket}, "\n"; } } return; } sub list_bucket { my $s3 = shift; my $b = shift; my $opt_long = shift; my $r = $b->{bucketobject}->list_all(); if ($opt_long) { foreach (@{$r->{keys}}) { print $_->{owner_id}, "/", $_->{owner_displayname}, "\t"; print $_->{last_modified}, "\t"; print $_->{etag}, "\t"; print $_->{size}, "\t"; print $_->{key}, "\n"; } } else { foreach (@{$r->{keys}}) { print $_->{key}, "\n"; } } return; } sub list_item { my $s3 = shift; my $b = shift; # an S3 item can have many interesting standard HTTP headers, # including Content-Length, Content-Type, Content-Language, # Expires, Cache-Control, Content-Disposition, and # Content-Encoding, in addition to the x-amz- metadata headers if ($opt_long) { print "bucket: ", $b->{bucketname}, "\n"; print "itemkey: ", $b->{itemkey}, "\n"; my $r = $b->{bucketobject}->head_key($b->{itemkey}); foreach (sort(keys(%{$r}))) { next if $_ eq 'client-date'; next if $_ eq 'client-response-num'; next if $_ eq 'key'; next if $_ eq 'date'; next if $_ eq 'value'; next if $_ eq 'server'; next if $_ eq 'content-type'; next if $_ eq 'x-amz-request-id'; next if $_ eq 'x-amz-id-2'; next if $_ eq 'client-peer'; print $_, ": ", $r->{$_}, "\n"; } } else { print "bucket: ", $b->{bucketname}, "\n"; print "itemkey: ", $b->{itemkey}, "\n"; } print "\n"; return; } __END__ =head1 NAME s3ls - List S3 buckets and bucket contents =head1 SYNOPSIS s3ls [options] s3ls [options] [ [ bucket | bucket/item ] ...] Options: --access-key AWS Access Key ID --secret-key AWS Secret Access Key --long Environment: AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_SECRET =head1 OPTIONS =over 8 =item B<--help> Print a brief help message and exits. =item B<--man> Prints the manual page and exits. =item B<--verbose> Output what is being done as it is done. =item B<--access-key> and B<--secret-key> Specify the "AWS Access Key Identifiers" for the AWS account. B<--access-key> is the "Access Key ID", and B<--secret-key> is the "Secret Access Key". These are effectively the "username" and "password" to the AWS account, and should be kept confidential. The access keys MUST be specified, either via these command line parameters, or via the B and B environment variables. Specifying them on the command line overrides the environment variables. =item B<--secure> Uses SSL/TLS HTTPS to communicate with the AWS service, instead of HTTP. =item B<--long> =back =head1 ENVIRONMENT VARIABLES =over 8 =item B and B Specify the "AWS Access Key Identifiers" for the AWS account. B contains the "Access Key ID", and B contains the "Secret Access Key". These are effectively the "username" and "password" to the AWS service, and should be kept confidential. The access keys MUST be specified, either via these environment variables, or via the B<--access-key> and B<--secret-key> command line parameters. If the command line parameters are set, they override these environment variables. =back =head1 CONFIGURATION FILE The configuration options will be read from the file C<~/.s3-tools> if it exists. The format is the same as the command line options with one option per line. For example, the file could contain: --access-key --secret-key --secure This example configuration file would specify the AWS access keys and that a secure connection using HTTPS should be used for all communications. =head1 DESCRIPTION Lists the buckets owned by the user, or all the item keys in a given bucket, or attributes associated with a given item. If no buckets or bucket/itemkey is specified on the command line, all the buckets owned by the user are listed. If the C<--long> option is specified, the creation date of each bucket is also output. If a bucket name is specified on the command line, all the item keys in that bucket are listed. If the C<--long> option is specified, the ID and display string of the item owner, the creation date, the MD5, and the size of the item are also output. If a bucket name and an item key, seperated by a slash character, is specified on the command line, then the bucket name and the item key are output. This is useful to check that the item actually exists. If the C<--long> option is specified, all the HTTP attributes of the item are also output. This will include Content-Length, Content-Type, ETag (which is the MD5 of the item contents), and Last-Modifed. It may also include the HTTP attributes Content-Language, Expires, Cache-Control, Content-Disposition, and Content-Encoding. It will also include any x-amz- metadata headers. =head1 BUGS Report bugs to Mark Atwood L. Occasionally the S3 service will randomly fail for no externally apparent reason. When that happens, this tool should retry, with a delay and a backoff. Access to the S3 service can be authenticated with a X.509 certificate, instead of via the "AWS Access Key Identifiers". This tool should support that. It might be useful to be able to specify the "AWS Access Key Identifiers" in the user's C<~/.netrc> file. This tool should support that. Errors and warnings are very "Perl-ish", and can be confusing. Trying to access a bucket or item that does not exist or is not accessable by the user generates less than helpful error messages. This tool does not efficiently handle listing huge buckets, as it downloads and parses the entire bucket listing, before it outputs anything. This tool does not take advantage of the prefix, delimiter, and hierarchy features of the AWS S3 key listing API. =head1 AUTHOR Written by Mark Atwood L. Many thanks to Wotan LLC L, for supporting the development of these S3 tools. Many thanks to the Amazon AWS engineers for developing S3. =head1 SEE ALSO These tools use the L Perl module. The Amazon Simple Storage Service (S3) is documented at L. =cut s3-tools-0.08/s3mkbucket0000755000000000000000000001674011153637251015303 0ustar00usergroup00000000000000#!/usr/local/bin/perl # Copyright (C) 2007 by Mark Atwood . # # This module is not an official Amazon product or service. Information # used to create this module was obtained only from publicly available # information, mainly from the published Amazon documentation. # # This module is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 2.1 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 # and the GNU Lesser General Public License along with this program. # If not, see . use warnings; use strict; use Getopt::Long; use Pod::Usage; use Net::Amazon::S3; use Net::Amazon::S3::Bucket; use Getopt::ArgvFile qw/argvFile/; use File::HomeDir; use vars qw/$OWNER_ID $OWNER_DISPLAYNAME/; my $aws_access_key_id = $ENV{AWS_ACCESS_KEY_ID}; my $aws_secret_access_key = $ENV{AWS_ACCESS_KEY_SECRET}; my $opt_verbose =0; my $opt_help =0; my $opt_man =0; my $opt_acl_short = undef; my $opt_secure =0; # get the options from users ~/.s3-tools file, if it exists my $users_config = File::HomeDir->my_home() . '/.s3-tools'; if (-e $users_config) { unshift @ARGV, '@' . $users_config; } argvFile(); GetOptions('help|?' => \$opt_help, 'man' => \$opt_man, 'verbose+' => \$opt_verbose, 'access-key=s' => \$aws_access_key_id, 'secret-key=s' => \$aws_secret_access_key, 'acl-short=s' => \$opt_acl_short, 'secure' => \$opt_secure ) or pod2usage(2); pod2usage(1) if $opt_help; pod2usage(-exitstatus => 0, -verbose => 2) if $opt_man; my $s3p = { aws_access_key_id => $aws_access_key_id, aws_secret_access_key => $aws_secret_access_key }; $s3p->{secure} = $opt_secure if ($opt_secure); my $s3 = Net::Amazon::S3->new($s3p); ($s3) or die("$0: fail Net::Amazon::S3: $!, stopped"); my %bkt; foreach my $bktn (@ARGV) { my $p = { bucket => $bktn }; $p->{acl_short} = $opt_acl_short if ($opt_acl_short); eval { $bkt{$bktn} = $s3->add_bucket($p); }; if ($bkt{$bktn}) { print STDERR "$0: created bucket \"$bktn\"\n" if $opt_verbose; } else { print STDERR "$0: cannot create bucket \"$bktn\": " . $s3->err . ": " . $s3->errstr . "\n"; } } __END__ =head1 NAME s3mkbucket - Create Amazon AWS S3 buckets =head1 SYNOPSIS s3mkbucket [options] [bucket ...] Options: --access-key AWS Access Key ID --secret-key AWS Secret Access Key --acl-short private|public-read|public-read-write|authenticated-read Environment: AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_SECRET =head1 OPTIONS =over 8 =item B<--help> Print a brief help message and exits. =item B<--man> Prints the manual page and exits. =item B<--verbose> Print a message for each created bucket. =item B<--access-key> and B<--secret-key> Specify the "AWS Access Key Identifiers" for the AWS account. B<--access-key> is the "Access Key ID", and B<--secret-key> is the "Secret Access Key". These are effectively the "username" and "password" to the AWS account, and should be kept confidential. The access keys MUST be specified, either via these command line parameters, or via the B and B environment variables. Specifying them on the command line overrides the environment variables. =item B<--secure> Uses SSL/TLS HTTPS to communicate with the AWS service, instead of HTTP. =item B<--acl-short> Apply a "canned ACL" to the bucket when it is created. To set a more complex ACL, use the C tool after the bucket is created. The following canned ACLs are currently defined by S3: =over 8 =item B Owner gets C. No one else has any access rights. This is the default. =item B Owner gets C. The anonymous principal is granted C access. =item B Owner gets C. The anonymous principal is granted C and C access. This is a useful policy to apply to a bucket, if you intend for any anonymous user to PUT objects into the bucket. =item B Owner gets C . Any principal authenticated as a registered Amazon S3 user is granted C access. =back =item B One or more bucket names. As many as possible will be created. A user may have no more than 100 buckets. Bucket names must be between 3 and 255 characters long, and can only contain alphanumeric characters, underscore, period, and dash. Bucket names are case sensitive. Buckets with names containing uppercase characters or underscores are not accessible using the virtual hosting method. Buckets are unique in a global namespace. That means if someone has created a bucket with a given name, someone else cannot create another bucket with the same name. If a bucket name begins with one or more dashes, it might be mistaken for a command line option. If this is the case, separate the command line options from the bucket names with two dashes, like so: s3mkbucket --verbose -- --bucketname =back =head1 ENVIRONMENT VARIABLES =over 8 =item B and B Specify the "AWS Access Key Identifiers" for the AWS account. B contains the "Access Key ID", and B contains the "Secret Access Key". These are effectively the "username" and "password" to the AWS service, and should be kept confidential. The access keys MUST be specified, either via these environment variables, or via the B<--access-key> and B<--secret-key> command line parameters. If the command line parameters are set, they override these environment variables. =back =head1 CONFIGURATION FILE The configuration options will be read from the file C<~/.s3-tools> if it exists. The format is the same as the command line options with one option per line. For example, the file could contain: --access-key --secret-key --secure This example configuration file would specify the AWS access keys and that a secure connection using HTTPS should be used for all communications. =head1 DESCRIPTION Create buckets in the Amazon Simple Storage Service (S3). =head1 BUGS Report bugs to Mark Atwood L. Making a bucket that already exists and is owned by the user does not fail. It is unclear whether this is a bug or not. Occasionally the S3 service will randomly fail for no externally apparent reason. When that happens, this tool should retry, with a delay and a backoff. Access to the S3 service can be authenticated with a X.509 certificate, instead of via the "AWS Access Key Identifiers". This tool should support that. It might be useful to be able to specify the "AWS Access Key Identifiers" in the user's C<~/.netrc> file. This tool should support that. Errors and warnings are very "Perl-ish", and can be confusing. =head1 AUTHOR Written by Mark Atwood L. Many thanks to Wotan LLC L, for supporting the development of these S3 tools. Many thanks to the Amazon AWS engineers for developing S3. =head1 SEE ALSO These tools use the L Perl module. The Amazon Simple Storage Service (S3) is documented at L. =cut s3-tools-0.08/s3put0000755000000000000000000001537111153637251014305 0ustar00usergroup00000000000000#!/usr/local/bin/perl # Copyright (C) 2007 by Mark Atwood . # # This module is not an official Amazon product or service. Information # used to create this module was obtained only from publicly available # information, mainly from the published Amazon documentation. # # This module is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 2.1 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 # and the GNU Lesser General Public License along with this program. # If not, see . use warnings; use strict; use Getopt::Long; use Pod::Usage; use Net::Amazon::S3; use Net::Amazon::S3::Bucket; use Getopt::ArgvFile qw/argvFile/; use File::HomeDir; my $aws_access_key_id = $ENV{AWS_ACCESS_KEY_ID}; my $aws_secret_access_key = $ENV{AWS_ACCESS_KEY_SECRET}; my $opt_verbose =0; my $opt_help =0; my $opt_man =0; my $opt_acl_short = undef; my $opt_secure =0; my $opt_mimetype = undef; my @opt_amzmeta; my @opt_httpheader; # get the options from the users ~/.s3-tools file, if it exists my $users_config = File::HomeDir->my_home() . '/.s3-tools'; if (-e $users_config) { unshift @ARGV, '@' . $users_config; } argvFile(); GetOptions('help|?' => \$opt_help, 'man' => \$opt_man, 'verbose+' => \$opt_verbose, 'access-key=s' => \$aws_access_key_id, 'secret-key=s' => \$aws_secret_access_key, 'acl-short=s' => \$opt_acl_short, 'secure' => \$opt_secure, 'mime-type=s' => \$opt_mimetype, 'amz-meta=s' => \@opt_amzmeta, 'http-header=s' => \@opt_httpheader, ) or pod2usage(2); pod2usage(1) if $opt_help; pod2usage(-exitstatus => 0, -verbose => 2) if $opt_man; my $s3p = { aws_access_key_id => $aws_access_key_id, aws_secret_access_key => $aws_secret_access_key }; $s3p->{secure} = $opt_secure if ($opt_secure); my $s3 = Net::Amazon::S3->new($s3p); ($s3) or die("$0: fail Net::Amazon::S3: $!, stopped"); my $slurp; { local($/); $slurp = ; } my $p = { }; $p->{acl_short} = $opt_acl_short if ($opt_acl_short); $p->{content_type} = $opt_mimetype if ($opt_mimetype); foreach (@opt_amzmeta) { my ($k, $v) = split('=', $_, 2); $p->{ 'x-amz-meta-' . $k } = $v; } foreach (@opt_httpheader) { my ($k, $v) = split('=', $_, 2); $p->{ $k } = $v; } my $bkts = make_bucketlist(); my $b = shift(@{$bkts}); # pick off the first one # todo, warning if more than one bucket my $r = $b->{bucketobject}->add_key($b->{itemkey}, $slurp, $p); sub make_bucketlist { my @B; my ($bn, $ik, $b); foreach my $arg (@ARGV) { $b = undef; $b->{arg} = $arg; ($bn, $ik) = split('/', $arg, 2); $b->{bucketname} = $bn; $b->{itemkey} = $ik if ($ik); $b->{bucketobject} = $s3->bucket($bn); push @B, $b; } return \@B; } __END__ =head1 NAME s3put - Write an S3 item =head1 SYNOPSIS s3put [options] [ bucket/item ...] Options: --access-key AWS Access Key ID --secret-key AWS Secret Access Key Environment: AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_SECRET =head1 OPTIONS =over 8 =item B<--help> Print a brief help message and exits. =item B<--man> Prints the manual page and exits. =item B<--verbose> Output what is being done as it is done. =item B<--access-key> and B<--secret-key> Specify the "AWS Access Key Identifiers" for the AWS account. B<--access-key> is the "Access Key ID", and B<--secret-key> is the "Secret Access Key". These are effectively the "username" and "password" to the AWS account, and should be kept confidential. The access keys MUST be specified, either via these command line parameters, or via the B and B environment variables. Specifying them on the command line overrides the environment variables. =item B<--secure> Uses SSL/TLS HTTPS to communicate with the AWS service, instead of HTTP. =back =head1 ENVIRONMENT VARIABLES =over 8 =item B and B Specify the "AWS Access Key Identifiers" for the AWS account. B contains the "Access Key ID", and B contains the "Secret Access Key". These are effectively the "username" and "password" to the AWS service, and should be kept confidential. The access keys MUST be specified, either via these environment variables, or via the B<--access-key> and B<--secret-key> command line parameters. If the command line parameters are set, they override these environment variables. =back =head1 CONFIGURATION FILE The configuration options will be read from the file C<~/.s3-tools> if it exists. The format is the same as the command line options with one option per line. For example, the file could contain: --access-key --secret-key --secure This example configuration file would specify the AWS access keys and that a secure connection using HTTPS should be used for all communications. =head1 DESCRIPTION Reads stdin, and writes it to an S3 item =head1 BUGS Report bugs to Mark Atwood L. Occasionally the S3 service will randomly fail for no externally apparent reason. When that happens, this tool should retry, with a delay and a backoff. Access to the S3 service can be authenticated with a X.509 certificate, instead of via the "AWS Access Key Identifiers". This tool should support that. It might be useful to be able to specify the "AWS Access Key Identifiers" in the user's C<~/.netrc> file. This tool should support that. Errors and warnings are very "Perl-ish", and can be confusing. Trying to write to a bucket that does not exist or is not accessable by the user generates less than helpful error messages. Trying to put a bucket instead of an item is silently skipped. =head1 TODO option to read from files instead of stdin use the fs mtime to set the http Last-Modified option to read filenames to read from, from stdin option to read from a tar file stream, for multiple items option to magically guess mime type option to use extended file attributes for metadata option to have a progress bar =head1 AUTHOR Written by Mark Atwood L. Many thanks to Wotan LLC L, for supporting the development of these S3 tools. Many thanks to the Amazon AWS engineers for developing S3. =head1 SEE ALSO These tools use the L Perl module. The Amazon Simple Storage Service (S3) is documented at L. =cut s3-tools-0.08/s3rm0000755000000000000000000001372711153637251014116 0ustar00usergroup00000000000000#!/usr/local/bin/perl # Copyright (C) 2009 by Mark Atwood . # # This module is not an official Amazon product or service. Information # used to create this module was obtained only from publicly available # information, mainly from the published Amazon documentation. # # This module is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 2.1 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 # and the GNU Lesser General Public License along with this program. # If not, see . use warnings; use strict; use Getopt::Long; use Pod::Usage; use Net::Amazon::S3; use Net::Amazon::S3::Bucket; use Getopt::ArgvFile qw/argvFile/; use File::HomeDir; use vars qw/$OWNER_ID $OWNER_DISPLAYNAME/; my $aws_access_key_id = $ENV{AWS_ACCESS_KEY_ID}; my $aws_secret_access_key = $ENV{AWS_ACCESS_KEY_SECRET}; my $opt_verbose =0; my $opt_help =0; my $opt_man =0; my $opt_secure =0; # get the options from the users ~/.s3-tools file, if it exists my $users_config = File::HomeDir->my_home() . '/.s3-tools'; if (-e $users_config) { unshift @ARGV, '@' . $users_config; } argvFile(); GetOptions('help|?' => \$opt_help, 'man' => \$opt_man, 'verbose+' => \$opt_verbose, 'access-key=s' => \$aws_access_key_id, 'secret-key=s' => \$aws_secret_access_key, 'secure' => \$opt_secure ) or pod2usage(2); pod2usage(1) if $opt_help; pod2usage(-exitstatus => 0, -verbose => 2) if $opt_man; my $s3p = { aws_access_key_id => $aws_access_key_id, aws_secret_access_key => $aws_secret_access_key }; $s3p->{secure} = $opt_secure if ($opt_secure); my $s3 = Net::Amazon::S3->new($s3p); ($s3) or die("$0: fail Net::Amazon::S3: $!, stopped"); my $bkts = make_bucketlist(); foreach my $b (@{$bkts}) { next unless $b->{itemkey}; if ($b->{bucketobject}->delete_key($b->{itemkey})) { print STDERR "$0: deleted item " . $b->{bucketname} . "/" . $b->{itemkey} . "\n" if $opt_verbose; } else { print STDERR "$0: cannot delete item " . $b->{bucketname} . "/" . $b->{itemkey} . " :" . $s3->err . ": " . $s3->errstr . "\n"; } } # TODO, refactor this out and put it in the module sub make_bucketlist { my @B; my ($bn, $ik, $b); foreach my $arg (@ARGV) { $b = undef; $b->{arg} = $arg; ($bn, $ik) = split('/', $arg, 2); $b->{bucketname} = $bn; $b->{itemkey} = $ik if ($ik); $b->{bucketobject} = $s3->bucket($bn); push @B, $b; } return \@B; } __END__ =head1 NAME s3rm - Delete Amazon AWS S3 items =head1 SYNOPSIS s3rm [options] [bucket/item ...] Options: --access-key AWS Access Key ID --secret-key AWS Secret Access Key Environment: AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_SECRET =head1 OPTIONS =over 8 =item B<--help> Print a brief help message and exits. =item B<--man> Prints the manual page and exits. =item B<--verbose> Print a message for each created bucket. =item B<--access-key> and B<--secret-key> Specify the "AWS Access Key Identifiers" for the AWS account. B<--access-key> is the "Access Key ID", and B<--secret-key> is the "Secret Access Key". These are effectively the "username" and "password" to the AWS account, and should be kept confidential. The access keys MUST be specified, either via these command line parameters, or via the B and B environment variables. Specifying them on the command line overrides the environment variables. =item B<--secure> Uses SSL/TLS HTTPS to communicate with the AWS service, instead of HTTP. =back =head1 ENVIRONMENT VARIABLES =over 8 =item B and B Specify the "AWS Access Key Identifiers" for the AWS account. B contains the "Access Key ID", and B contains the "Secret Access Key". These are effectively the "username" and "password" to the AWS service, and should be kept confidential. The access keys MUST be specified, either via these environment variables, or via the B<--access-key> and B<--secret-key> command line parameters. If the command line parameters are set, they override these environment variables. =back =head1 CONFIGURATION FILE The configuration options will be read from the file C<~/.s3-tools> if it exists. The format is the same as the command line options with one option per line. For example, the file could contain: --access-key --secret-key --secure This example configuration file would specify the AWS access keys and that a secure connection using HTTPS should be used for all communications. =head1 DESCRIPTION Delete items in the Amazon Simple Storage Service (S3). =head1 BUGS Report bugs to Mark Atwood L. Occasionally the S3 service will randomly fail for no externally apparent reason. When that happens, this tool should retry, with a delay and a backoff. Access to the S3 service can be authenticated with a X.509 certificate, instead of via the "AWS Access Key Identifiers". This tool should support that. It might be useful to be able to specify the "AWS Access Key Identifiers" in the user's C<~/.netrc> file. This tool should support that. Some errors and warnings are very "Perl-ish", and can be confusing. =head1 AUTHOR Written by Mark Atwood L. Many thanks to Wotan LLC L, for supporting the development of these S3 tools. Many thanks to the Amazon AWS engineers for developing S3. =head1 SEE ALSO These tools use the L Perl module. The Amazon Simple Storage Service (S3) is documented at L. =cut s3-tools-0.08/s3rmbucket0000755000000000000000000001455711153637251015316 0ustar00usergroup00000000000000#!/usr/local/bin/perl # Copyright (C) 2007 by Mark Atwood . # # This module is not an official Amazon product or service. Information # used to create this module was obtained only from publicly available # information, mainly from the published Amazon documentation. # # This module is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 2.1 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 # and the GNU Lesser General Public License along with this program. # If not, see . use warnings; use strict; use Getopt::Long; use Pod::Usage; use Net::Amazon::S3; use Net::Amazon::S3::Bucket; use Getopt::ArgvFile qw/argvFile/; use File::HomeDir; use vars qw/$OWNER_ID $OWNER_DISPLAYNAME/; my $aws_access_key_id = $ENV{AWS_ACCESS_KEY_ID}; my $aws_secret_access_key = $ENV{AWS_ACCESS_KEY_SECRET}; my $opt_verbose =0; my $opt_help =0; my $opt_man =0; my $opt_secure =0; # get the options from the users ~/.s3-tools file, if it exists my $users_config = File::HomeDir->my_home() . '/.s3-tools'; if (-e $users_config) { unshift @ARGV, '@' . $users_config; } argvFile(); GetOptions('help|?' => \$opt_help, 'man' => \$opt_man, 'verbose+' => \$opt_verbose, 'access-key=s' => \$aws_access_key_id, 'secret-key=s' => \$aws_secret_access_key, 'secure' => \$opt_secure ) or pod2usage(2); pod2usage(1) if $opt_help; pod2usage(-exitstatus => 0, -verbose => 2) if $opt_man; my $s3p = { aws_access_key_id => $aws_access_key_id, aws_secret_access_key => $aws_secret_access_key }; $s3p->{secure} = $opt_secure if ($opt_secure); my $s3 = Net::Amazon::S3->new($s3p); ($s3) or die("$0: fail Net::Amazon::S3: $!, stopped"); my %bkt; foreach my $bktn (@ARGV) { my $p = { bucket => $bktn }; eval { $bkt{$bktn} = $s3->delete_bucket($p); }; if ($bkt{$bktn}) { print STDERR "$0: deleted bucket \"$bktn\"\n" if $opt_verbose; } else { print STDERR "$0: cannot delete bucket \"$bktn\": " . $s3->err . ": " . $s3->errstr . "\n"; } } __END__ =head1 NAME s3rmbucket - Delete Amazon AWS S3 buckets =head1 SYNOPSIS s3rmbucket [options] [bucket ...] Options: --access-key AWS Access Key ID --secret-key AWS Secret Access Key Environment: AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_SECRET =head1 OPTIONS =over 8 =item B<--help> Print a brief help message and exits. =item B<--man> Prints the manual page and exits. =item B<--verbose> Print a message for each created bucket. =item B<--access-key> and B<--secret-key> Specify the "AWS Access Key Identifiers" for the AWS account. B<--access-key> is the "Access Key ID", and B<--secret-key> is the "Secret Access Key". These are effectively the "username" and "password" to the AWS account, and should be kept confidential. The access keys MUST be specified, either via these command line parameters, or via the B and B environment variables. Specifying them on the command line overrides the environment variables. =item B<--secure> Uses SSL/TLS HTTPS to communicate with the AWS service, instead of HTTP. =item B One or more bucket names. As many as possible will be deleted. A bucket may only be deleted if it is empty. Bucket names must be between 3 and 255 characters long, and can only contain alphanumeric characters, underscore, period, and dash. Bucket names are case sensitive. If a bucket name begins with one or more dashes, it might be mistaken for a command line option. If this is the case, separate the command line options from the bucket names with two dashes, like so: s3rmbucket --verbose -- --bucketname =back =head1 ENVIRONMENT VARIABLES =over 8 =item B and B Specify the "AWS Access Key Identifiers" for the AWS account. B contains the "Access Key ID", and B contains the "Secret Access Key". These are effectively the "username" and "password" to the AWS service, and should be kept confidential. The access keys MUST be specified, either via these environment variables, or via the B<--access-key> and B<--secret-key> command line parameters. If the command line parameters are set, they override these environment variables. =back =head1 CONFIGURATION FILE The configuration options will be read from the file C<~/.s3-tools> if it exists. The format is the same as the command line options with one option per line. For example, the file could contain: --access-key --secret-key --secure This example configuration file would specify the AWS access keys and that a secure connection using HTTPS should be used for all communications. =head1 DESCRIPTION Delete buckets in the Amazon Simple Storage Service (S3). A bucket may only be deleted if it is empty. =head1 BUGS Report bugs to Mark Atwood L. Occasionally the S3 service will randomly fail for no externally apparent reason. When that happens, this tool should retry, with a delay and a backoff. Access to the S3 service can be authenticated with a X.509 certificate, instead of via the "AWS Access Key Identifiers". This tool should support that. It might be useful to be able to specify the "AWS Access Key Identifiers" in the user's C<~/.netrc> file. This tool should support that. Some errors and warnings are very "Perl-ish", and can be confusing. A bucket can only be deleted if it is empty. It might be useful to add an option to delete every item in the bucket before then deleting it, similar to the semantics of the C command. This tool should support that. =head1 AUTHOR Written by Mark Atwood L. Many thanks to Wotan LLC L, for supporting the development of these S3 tools. Many thanks to the Amazon AWS engineers for developing S3. =head1 SEE ALSO These tools use the L Perl module. The Amazon Simple Storage Service (S3) is documented at L. =cut s3-tools-0.08/t/0000755000000000000000000000000011153637251013535 5ustar00usergroup00000000000000s3-tools-0.08/t/Net-Amazon-S3-Tools.t0000644000000000000000000000075311153637251017261 0ustar00usergroup00000000000000# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl Net-Amazon-S3-Tools.t' ######################### # change 'tests => 1' to 'tests => last_test_to_print'; use Test::More tests => 1; BEGIN { use_ok('Net::Amazon::S3::Tools') }; ######################### # Insert your test code below, the Test::More module is use()ed here so read # its man page ( perldoc Test::More ) for help writing this test script.