From 8cf4031ef5c64bd5e5def441777ae23188da7530 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 10 May 2021 09:15:44 -0700 Subject: [PATCH] add some self contained functions to contrib remove chinese doc translations, move docs to CC-BY 4.0 license --- .github/workflows/codeql.yml | 52 -- cmd/admin-user-add.go | 40 - cmd/admin-user-add_contrib.go | 62 ++ cmd/cp-main.go | 108 --- cmd/cp-main_contrib.go | 129 +++ docs/LICENSE | 395 ++++++++++ docs/zh_CN/CONTRIBUTING.md | 40 - docs/zh_CN/minio-client-complete-guide.md | 735 ------------------ .../zh_CN/minio-client-configuration-files.md | 80 -- 9 files changed, 586 insertions(+), 1055 deletions(-) delete mode 100644 .github/workflows/codeql.yml create mode 100644 cmd/admin-user-add_contrib.go create mode 100644 cmd/cp-main_contrib.go create mode 100644 docs/LICENSE delete mode 100644 docs/zh_CN/CONTRIBUTING.md delete mode 100644 docs/zh_CN/minio-client-complete-guide.md delete mode 100644 docs/zh_CN/minio-client-configuration-files.md diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 9771ca0f..00000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: "Code scanning - action" - -on: - push: - pull_request: - schedule: - - cron: '0 19 * * 0' - -jobs: - CodeQL-Build: - - # CodeQL runs on ubuntu-latest and windows-latest - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - # Override language selection by uncommenting this and choosing your languages - # with: - # languages: go, javascript, csharp, python, cpp, java - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/cmd/admin-user-add.go b/cmd/admin-user-add.go index af8c4170..e871d5db 100644 --- a/cmd/admin-user-add.go +++ b/cmd/admin-user-add.go @@ -17,9 +17,7 @@ package cmd import ( - "bufio" "fmt" - "os" "strings" "github.com/fatih/color" @@ -27,7 +25,6 @@ import ( json "github.com/minio/mc/pkg/colorjson" "github.com/minio/mc/pkg/probe" "github.com/minio/minio/pkg/console" - "golang.org/x/crypto/ssh/terminal" ) var adminUserAddCmd = cli.Command{ @@ -129,43 +126,6 @@ func (u userMessage) JSON() string { return string(jsonMessageBytes) } -// fetchUserKeys - returns the access and secret key -func fetchUserKeys(args cli.Args) (string, string) { - accessKey := "" - secretKey := "" - console.SetColor(cred, color.New(color.FgYellow, color.Italic)) - isTerminal := terminal.IsTerminal(int(os.Stdin.Fd())) - reader := bufio.NewReader(os.Stdin) - - argCount := len(args) - - if argCount == 1 { - if isTerminal { - fmt.Printf("%s", console.Colorize(cred, "Enter Access Key: ")) - } - value, _, _ := reader.ReadLine() - accessKey = string(value) - } else { - accessKey = args.Get(1) - } - - if argCount == 1 || argCount == 2 { - if isTerminal { - fmt.Printf("%s", console.Colorize(cred, "Enter Secret Key: ")) - bytePassword, _ := terminal.ReadPassword(int(os.Stdin.Fd())) - fmt.Printf("\n") - secretKey = string(bytePassword) - } else { - value, _, _ := reader.ReadLine() - secretKey = string(value) - } - } else { - secretKey = args.Get(2) - } - - return accessKey, secretKey -} - // mainAdminUserAdd is the handle for "mc admin user add" command. func mainAdminUserAdd(ctx *cli.Context) error { checkAdminUserAddSyntax(ctx) diff --git a/cmd/admin-user-add_contrib.go b/cmd/admin-user-add_contrib.go new file mode 100644 index 00000000..350d23ab --- /dev/null +++ b/cmd/admin-user-add_contrib.go @@ -0,0 +1,62 @@ +// MinIO Object Storage (c) 2021 MinIO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "bufio" + "fmt" + "os" + + "github.com/fatih/color" + "github.com/minio/cli" + "github.com/minio/minio/pkg/console" + "golang.org/x/crypto/ssh/terminal" +) + +// fetchUserKeys - returns the access and secret key +func fetchUserKeys(args cli.Args) (string, string) { + accessKey := "" + secretKey := "" + console.SetColor(cred, color.New(color.FgYellow, color.Italic)) + isTerminal := terminal.IsTerminal(int(os.Stdin.Fd())) + reader := bufio.NewReader(os.Stdin) + + argCount := len(args) + + if argCount == 1 { + if isTerminal { + fmt.Printf("%s", console.Colorize(cred, "Enter Access Key: ")) + } + value, _, _ := reader.ReadLine() + accessKey = string(value) + } else { + accessKey = args.Get(1) + } + + if argCount == 1 || argCount == 2 { + if isTerminal { + fmt.Printf("%s", console.Colorize(cred, "Enter Secret Key: ")) + bytePassword, _ := terminal.ReadPassword(int(os.Stdin.Fd())) + fmt.Printf("\n") + secretKey = string(bytePassword) + } else { + value, _, _ := reader.ReadLine() + secretKey = string(value) + } + } else { + secretKey = args.Get(2) + } + + return accessKey, secretKey +} diff --git a/cmd/cp-main.go b/cmd/cp-main.go index d36dc4a6..aa653ebe 100644 --- a/cmd/cp-main.go +++ b/cmd/cp-main.go @@ -22,7 +22,6 @@ import ( "errors" "fmt" "io" - "net/http" "os" "path/filepath" "strings" @@ -621,113 +620,6 @@ loop: return retErr } -// validate the passed metadataString and populate the map -func getMetaDataEntry(metadataString string) (map[string]string, *probe.Error) { - metaDataMap := make(map[string]string) - r := strings.NewReader(metadataString) - - type pToken int - const ( - KEY pToken = iota - VALUE - ) - - type pState int - const ( - NORMAL pState = iota - QSTRING - DQSTRING - ) - - var key, value strings.Builder - - writeRune := func(ch rune, pt pToken) { - if pt == KEY { - key.WriteRune(ch) - } else if pt == VALUE { - value.WriteRune(ch) - } else { - panic("Invalid parser token type") - } - } - - ps := NORMAL - pt := KEY - p := 0 - - for ; ; p++ { - ch, _, err := r.ReadRune() - if err != nil { - //eof - if ps == QSTRING || ps == DQSTRING || pt == KEY { - return nil, probe.NewError(ErrInvalidMetadata) - } - metaDataMap[http.CanonicalHeaderKey(key.String())] = value.String() - return metaDataMap, nil - } - - if ch == '"' { - if ps == DQSTRING { - ps = NORMAL - } else if ps == QSTRING { - writeRune(ch, pt) - } else if ps == NORMAL { - ps = DQSTRING - } else { - break - } - continue - } - - if ch == '\'' { - if ps == QSTRING { - ps = NORMAL - } else if ps == DQSTRING { - writeRune(ch, pt) - } else if ps == NORMAL { - ps = QSTRING - } else { - break - } - continue - } - - if ch == '=' { - if ps == QSTRING || ps == DQSTRING { - writeRune(ch, pt) - } else if pt == KEY { - pt = VALUE - } else if pt == VALUE { - writeRune(ch, pt) - } else { - break - } - continue - } - - if ch == ';' { - if ps == QSTRING || ps == DQSTRING { - writeRune(ch, pt) - } else if pt == KEY { - return nil, probe.NewError(ErrInvalidMetadata) - } else if pt == VALUE { - metaDataMap[http.CanonicalHeaderKey(key.String())] = value.String() - key.Reset() - value.Reset() - pt = KEY - } else { - break - } - continue - } - - writeRune(ch, pt) - } - - fatalErr := fmt.Sprintf("Invalid parser state at index: %d", p) - panic(fatalErr) -} - // mainCopy is the entry point for cp command. func mainCopy(cliCtx *cli.Context) error { ctx, cancelCopy := context.WithCancel(globalContext) diff --git a/cmd/cp-main_contrib.go b/cmd/cp-main_contrib.go new file mode 100644 index 00000000..ae983773 --- /dev/null +++ b/cmd/cp-main_contrib.go @@ -0,0 +1,129 @@ +// MinIO Object Storage (c) 2021 MinIO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "fmt" + "net/http" + "strings" + + "github.com/minio/mc/pkg/probe" +) + +// validate the passed metadataString and populate the map +func getMetaDataEntry(metadataString string) (map[string]string, *probe.Error) { + metaDataMap := make(map[string]string) + r := strings.NewReader(metadataString) + + type pToken int + const ( + KEY pToken = iota + VALUE + ) + + type pState int + const ( + NORMAL pState = iota + QSTRING + DQSTRING + ) + + var key, value strings.Builder + + writeRune := func(ch rune, pt pToken) { + if pt == KEY { + key.WriteRune(ch) + } else if pt == VALUE { + value.WriteRune(ch) + } else { + panic("Invalid parser token type") + } + } + + ps := NORMAL + pt := KEY + p := 0 + + for ; ; p++ { + ch, _, err := r.ReadRune() + if err != nil { + //eof + if ps == QSTRING || ps == DQSTRING || pt == KEY { + return nil, probe.NewError(ErrInvalidMetadata) + } + metaDataMap[http.CanonicalHeaderKey(key.String())] = value.String() + return metaDataMap, nil + } + + if ch == '"' { + if ps == DQSTRING { + ps = NORMAL + } else if ps == QSTRING { + writeRune(ch, pt) + } else if ps == NORMAL { + ps = DQSTRING + } else { + break + } + continue + } + + if ch == '\'' { + if ps == QSTRING { + ps = NORMAL + } else if ps == DQSTRING { + writeRune(ch, pt) + } else if ps == NORMAL { + ps = QSTRING + } else { + break + } + continue + } + + if ch == '=' { + if ps == QSTRING || ps == DQSTRING { + writeRune(ch, pt) + } else if pt == KEY { + pt = VALUE + } else if pt == VALUE { + writeRune(ch, pt) + } else { + break + } + continue + } + + if ch == ';' { + if ps == QSTRING || ps == DQSTRING { + writeRune(ch, pt) + } else if pt == KEY { + return nil, probe.NewError(ErrInvalidMetadata) + } else if pt == VALUE { + metaDataMap[http.CanonicalHeaderKey(key.String())] = value.String() + key.Reset() + value.Reset() + pt = KEY + } else { + break + } + continue + } + + writeRune(ch, pt) + } + + fatalErr := fmt.Sprintf("Invalid parser state at index: %d", p) + panic(fatalErr) +} diff --git a/docs/LICENSE b/docs/LICENSE new file mode 100644 index 00000000..2f244ac8 --- /dev/null +++ b/docs/LICENSE @@ -0,0 +1,395 @@ +Attribution 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution 4.0 International Public License ("Public License"). To the +extent this Public License may be interpreted as a contract, You are +granted the Licensed Rights in consideration of Your acceptance of +these terms and conditions, and the Licensor grants You such rights in +consideration of benefits the Licensor receives from making the +Licensed Material available under these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + d. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + e. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + f. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + g. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + h. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + i. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + j. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + k. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's + License You apply must not prevent recipients of the Adapted + Material from complying with this Public License. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material; and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/docs/zh_CN/CONTRIBUTING.md b/docs/zh_CN/CONTRIBUTING.md deleted file mode 100644 index 58ea9a8b..00000000 --- a/docs/zh_CN/CONTRIBUTING.md +++ /dev/null @@ -1,40 +0,0 @@ -### 设置你的mc Github Repository -Fork [mc upstream](https://github.com/minio/mc/fork)源码仓库到你的个人仓库。 -``` -$ mkdir -p $GOPATH/src/github.com/minio -$ cd $GOPATH/src/github.com/minio -$ git clone https://github.com/$USER_ID/mc -$ cd mc -$ make -$ mc --help -``` - -### 开发者指南 - -``mc``欢迎各位有识之士的贡献。为了让大家配合的更默契,我们做出如下约定: - -* 尽情的fork项目并修改,我们鼓励pull request来讨论代码的修改。 - - Fork项目 - - 创建你的特性分支(git checkout -b my-new-feature) - - Commit你的修改(git commit -am 'Add some feature') - - Push到你的远端 (git push origin my-new-feature) - - 创建一个新的Pull Request - -* 如果你有``mc``的更多依赖,``mc``使用[govendor](https://github.com/kardianos/govendor)管理它的依赖。 - - 运行`go get foo/bar` - - 修改你的代码,引入foo/bar - - 在根目录运行`make pkg-add PKG=foo/bar` - -* 如果你需要从``mc``中删除依赖 - - 修改你的代码,不引入foo/bar - - 在根目录运行`make pkg-remove PKG=foo/bar` - -* 如果你准备提起一个pull request请确保: - - 新写的代码有测试用例,如果你不知道咋弄,请在pull request中提出来。 - - 运行`go fmt` - - 使用`git rebase -i`将你的多个commit合并成一个,你可以强制更新你的pull request。 - - 确保`make build`完成。 - -* 参考[Effective Go](https://github.com/golang/go/wiki/CodeReviewComments) - - `mc`项目符合Golang风格。 - - 如果你发现有问题的代码,请随时提起issue或者pull request。 diff --git a/docs/zh_CN/minio-client-complete-guide.md b/docs/zh_CN/minio-client-complete-guide.md deleted file mode 100644 index 3331a28d..00000000 --- a/docs/zh_CN/minio-client-complete-guide.md +++ /dev/null @@ -1,735 +0,0 @@ -# MinIO Client完全指南 [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io) - -MinIO Client (mc)为ls,cat,cp,mirror,diff,find等UNIX命令提供了一种替代方案。它支持文件系统和兼容Amazon S3的云存储服务(AWS Signature v2和v4)。 - -``` -ls 列出文件和文件夹。 -mb 创建一个存储桶或一个文件夹。 -cat 显示文件和对象内容。 -pipe 将一个STDIN重定向到一个对象或者文件或者STDOUT。 -share 生成用于共享的URL。 -cp 拷贝文件和对象。 -mirror 给存储桶和文件夹做镜像。 -find 基于参数查找文件。 -diff 对两个文件夹或者存储桶比较差异。 -rm 删除文件和对象。 -events 管理对象通知。 -watch 监视文件和对象的事件。 -policy 管理访问策略。 -config 管理mc配置文件。 -update 检查软件更新。 -version 输出版本信息。 -``` - -## 1. 下载MinIO Client -### Docker稳定版 -``` -docker pull minio/mc -docker run minio/mc ls play -``` - -### Docker尝鲜版 -``` -docker pull minio/mc:edge -docker run minio/mc:edge ls play -``` - -**注意:** 上述示例默认使用MinIO[演示环境](#test-your-setup)做演示,如果想用`mc`操作其它S3兼容的服务,采用下面的方式来启动容器: - -``` -docker run -it --entrypoint=/bin/sh minio/mc -``` - -然后使用[`mc config`命令](#add-a-cloud-storage-service)。 - -### Homebrew (macOS) -使用[Homebrew](http://brew.sh/)安装mc。 - -``` -brew install minio/stable/mc -mc --help -``` - -### 下载二进制文件(GNU/Linux) -| 平台 | CPU架构 | URL | -| ---------- | -------- |------| -|GNU/Linux|64-bit Intel|https://dl.min.io/client/mc/release/linux-amd64/mc | - -``` -chmod +x mc -./mc --help -``` - -### 下载二进制文件(Microsoft Windows) -| 平台 | CPU架构 | URL | -| ---------- | -------- |------| -|Microsoft Windows|64-bit Intel|https://dl.min.io/client/mc/release/windows-amd64/mc.exe | - -``` -mc.exe --help -``` - -### 通过源码安装 -通过源码安装仅适用于开发人员和高级用户。`mc update`命令不支持基于源码安装的更新通知。请从[minio-client](https://min.io/download/#minio-client)下载官方版本。 - -如果您没有Golang环境,请按照 [如何安装Golang](https://golang.org/doc/install)。 - -``` -go get -d github.com/minio/mc -cd ${GOPATH}/src/github.com/minio/mc -make -``` - -## 2. 运行MinIO Client - -### GNU/Linux - -``` -chmod +x mc -./mc --help -``` - -### macOS - -``` -chmod 755 mc -./mc --help -``` - -### Microsoft Windows - -``` -mc.exe --help -``` - -## 3. 添加一个云存储服务 -如果你打算仅在POSIX兼容文件系统中使用`mc`,那你可以直接略过本节,跳到**Step 4**。 - -添加一个或多个S3兼容的服务,请参考下面说明。`mc`将所有的配置信息都存储在``~/.mc/config.json``文件中。 - -#### 使用 - -``` -mc alias set [--api API-SIGNATURE] -``` - -别名就是给你的云存储服务起了一个短点的外号。S3 endpoint,access key和secret key是你的云存储服务提供的。API签名是可选参数,默认情况下,它被设置为"S3v4"。 - -### 示例-MinIO云存储 -从MinIO服务获得URL、access key和secret key。 - - -``` -mc alias set minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v4 -``` - -### 示例-Amazon S3云存储 -参考[AWS Credentials指南](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)获取你的AccessKeyID和SecretAccessKey。 - -``` -mc alias set s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v4 -``` - -### 示例-Google云存储 -参考[Google Credentials Guide](https://cloud.google.com/storage/docs/migrating?hl=en#keys)获取你的AccessKeyID和SecretAccessKey。 - -``` -mc alias set gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v2 -``` - -注意:Google云存储只支持旧版签名版本V2,所以你需要选择S3v2。 - -## 4. 验证 -`mc`预先配置了云存储服务URL:[https://play.min.io](https://play.min.io),别名“play”。它是一个用于研发和测试的MinIO服务。如果想测试Amazon S3,你可以将“play”替换为“s3”。 - -*示例:* - -列出[https://play.min.io](https://play.min.io)上的所有存储桶。 - -``` -mc ls play -[2016-03-22 19:47:48 PDT] 0B my-bucketname/ -[2016-03-22 22:01:07 PDT] 0B mytestbucket/ -[2016-03-22 20:04:39 PDT] 0B mybucketname/ -[2016-01-28 17:23:11 PST] 0B newbucket/ -[2016-03-20 09:08:36 PDT] 0B s3git-test/ -``` - -## 5. 日常使用 -你可以添加shell别名来覆盖默认的Unix工具命令。 - -``` -alias ls='mc ls' -alias cp='mc cp' -alias cat='mc cat' -alias mkdir='mc mb' -alias pipe='mc pipe' -alias find='mc find' -``` - -## 6. 全局参数 - -### 参数 [--debug] -Debug参数开启控制台输出debug信息。 - -*示例:输出`ls`命令的详细debug信息。* - -``` -mc --debug ls play -mc: GET / HTTP/1.1 -Host: play.min.io -User-Agent: MinIO (darwin; amd64) minio-go/1.0.1 mc/2016-04-01T00:22:11Z -Authorization: AWS4-HMAC-SHA256 Credential=**REDACTED**/20160408/us-east-1/s3/aws4_request, SignedHeaders=expect;host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED** -Expect: 100-continue -X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -X-Amz-Date: 20160408T145236Z -Accept-Encoding: gzip - -mc: HTTP/1.1 200 OK -Transfer-Encoding: chunked -Accept-Ranges: bytes -Content-Type: text/xml; charset=utf-8 -Date: Fri, 08 Apr 2016 14:54:55 GMT -Server: MinIO/DEVELOPMENT.2016-04-07T18-53-27Z (linux; amd64) -Vary: Origin -X-Amz-Request-Id: HP30I0W2U49BDBIO - -mc: Response Time: 1.220112837s - -[...] - -[2016-04-08 03:56:14 IST] 0B albums/ -[2016-04-04 16:11:45 IST] 0B backup/ -[2016-04-01 20:10:53 IST] 0B deebucket/ -[2016-03-28 21:53:49 IST] 0B guestbucket/ -``` - -### 参数 [--json] -JSON参数启用JSON格式的输出。 - -*示例:列出MinIO play服务的所有存储桶。* - -``` -mc --json ls play -{"status":"success","type":"folder","lastModified":"2016-04-08T03:56:14.577+05:30","size":0,"key":"albums/"} -{"status":"success","type":"folder","lastModified":"2016-04-04T16:11:45.349+05:30","size":0,"key":"backup/"} -{"status":"success","type":"folder","lastModified":"2016-04-01T20:10:53.941+05:30","size":0,"key":"deebucket/"} -{"status":"success","type":"folder","lastModified":"2016-03-28T21:53:49.217+05:30","size":0,"key":"guestbucket/"} -``` - -### 参数 [--no-color] -这个参数禁用颜色主题。对于一些比较老的终端有用。 - -### 参数 [--quiet] -这个参数关闭控制台日志输出。 - -### 参数 [--config-dir] -这个参数参数自定义的配置文件路径。 - -### 参数 [ --insecure] -跳过SSL证书验证。 - -## 7. 命令 - -| | | | -|:-------------------------------------|:---------------------------------------------------|:---------------------------------------| -| [**ls** - 列出存储桶和对象](#ls) | [**mb** - 创建存储桶](#mb) | [**cat** - 合并对象](#cat) | -| [**cp** - 拷贝对象](#cp) | [**rm** - 删除对象](#rm) | [**pipe** - Pipe到一个对象](#pipe) | -| [**share** - 共享](#share) | [**mirror** - 存储桶镜像](#mirror) | [**find** - 查找文件和对象](#find) | -| [**diff** - 比较存储桶差异](#diff) | [**policy** - 给存储桶或前缀设置访问策略](#policy) | | -| [**config** - 管理配置文件](#config) | [**watch** - 事件监听](#watch) | [**events** - 管理存储桶事件](#events) | -| [**update** - 管理软件更新](#update) | [**version** - 显示版本信息](#version) | | - - -### `ls`命令 - 列出对象 -`ls`命令列出文件、对象和存储桶。使用`--incomplete` flag可列出未完整拷贝的内容。 - -``` -用法: - mc ls [FLAGS] TARGET [TARGET ...] - -FLAGS: - --help, -h 显示帮助。 - --recursive, -r 递归。 - --incomplete, -I 列出未完整上传的对象。 -``` - -*示例: 列出所有https://play.min.io上的存储桶。* - -``` -mc ls play -[2016-04-08 03:56:14 IST] 0B albums/ -[2016-04-04 16:11:45 IST] 0B backup/ -[2016-04-01 20:10:53 IST] 0B deebucket/ -[2016-03-28 21:53:49 IST] 0B guestbucket/ -[2016-04-08 20:58:18 IST] 0B mybucket/ -``` - -### `mb`命令 - 创建存储桶 -`mb`命令在对象存储上创建一个新的存储桶。在文件系统,它就和`mkdir -p`命令是一样的。存储桶相当于文件系统中的磁盘或挂载点,不应视为文件夹。MinIO对每个​​用户创建的存储桶数量没有限制。 -在Amazon S3上,每个帐户被限制为100个存储桶。有关更多信息,请参阅[S3上的存储桶限制和限制](http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html) 。 - -``` -用法: - mc mb [FLAGS] TARGET [TARGET...] - -FLAGS: - --help, -h 显示帮助。 - --region "us-east-1" 指定存储桶的region,默认是‘us-east-1’. - -``` - -*示例:在https://play.min.io上创建一个名叫"mybucket"的存储桶。* - - -``` -mc mb play/mybucket -Bucket created successfully ‘play/mybucket’. -``` - - - -### `cat`命令 - 合并对象 -`cat`命令将一个文件或者对象的内容合并到另一个上。你也可以用它将对象的内容输出到stdout。 - -``` -用法: - mc cat [FLAGS] SOURCE [SOURCE...] - -FLAGS: - --help, -h 显示帮助。 -``` - -*示例: 显示`myobject.txt`文件的内容* - -``` -mc cat play/mybucket/myobject.txt -Hello MinIO!! -``` - -### `pipe`命令 - Pipe到对象 -`pipe`命令拷贝stdin里的内容到目标输出,如果没有指定目标输出,则输出到stdout。 - -``` -用法: - mc pipe [FLAGS] [TARGET] - -FLAGS: - --help, -h 显示帮助。 -``` - -*示例: 将MySQL数据库dump文件输出到Amazon S3。* - -``` -mysqldump -u root -p ******* accountsdb | mc pipe s3/sql-backups/backups/accountsdb-oct-9-2015.sql -``` - - -### `cp`命令 - 拷贝对象 -`cp`命令拷贝一个或多个源文件目标输出。所有到对象存储的拷贝操作都进行了MD4SUM checkSUM校验。可以从故障点恢复中断或失败的复制操作。 - -``` -用法: - mc cp [FLAGS] SOURCE [SOURCE...] TARGET - -FLAGS: - --help, -h 显示帮助。 - --recursive, -r 递归拷贝。 -``` - -*示例: 拷贝一个文本文件到对象存储。* - -``` -mc cp myobject.txt play/mybucket -myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 41 B/s 0 -``` - -### `rm`命令 - 删除存储桶和对象。 -使用`rm`命令删除文件对象或者存储桶。 - -``` -用法: - mc rm [FLAGS] TARGET [TARGET ...] - -FLAGS: - --help, -h 显示帮助。 - --recursive, -r 递归删除。 - --force 强制执行删除操作。 - --prefix 删除批配这个前缀的对象。 - --incomplete, -I 删除未完整上传的对象。 - --fake 模拟一个假的删除操作。 - --stdin 从STDIN中读对象列表。 - --older-than value 删除N天前的对象(默认是0天)。 -``` - -*示例: 删除一个对象。* - -``` -mc rm play/mybucket/myobject.txt -Removed ‘play/mybucket/myobject.txt’. -``` - -*示例:删除一个存储桶并递归删除里面所有的内容。由于这个操作太危险了,你必须传`--force`参数指定强制删除。* - -``` -mc rm --recursive --force play/myobject -Removed ‘play/myobject/newfile.txt’. -Removed 'play/myobject/otherobject.txt’. -``` - -*示例: 从`mybucket`里删除所有未完整上传的对象。* - -``` -mc rm --incomplete --recursive --force play/mybucket -Removed ‘play/mybucket/mydvd.iso’. -Removed 'play/mybucket/backup.tgz’. -``` -*示例: 删除一天前的对象。* - -``` -mc rm --force --older-than=1 play/mybucket/oldsongs -``` - - -### `share`命令 - 共享 -`share`命令安全地授予上传或下载的权限。此访问只是临时的,与远程用户和应用程序共享也是安全的。如果你想授予永久访问权限,你可以看看`mc policy`命令。 - -生成的网址中含有编码后的访问认证信息,任何企图篡改URL的行为都会使访问无效。想了解这种机制是如何工作的,请参考[Pre-Signed URL](http://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html)技术。 - -``` -用法: - mc share [FLAGS] COMMAND - -FLAGS: - --help, -h 显示帮助。 - -COMMANDS: - download 生成有下载权限的URL。 - upload 生成有上传权限的URL。 - list 列出先前共享的对象和文件夹。 -``` - -### 子命令`share download` - 共享下载 -`share download`命令生成不需要access key和secret key即可下载的URL,过期参数设置成最大有效期(不大于7天),过期之后权限自动回收。 - -``` -用法: - mc share download [FLAGS] TARGET [TARGET...] - -FLAGS: - --help, -h 显示帮助。 - --recursive, -r 递归共享所有对象。 - --expire, -E "168h" 设置过期时限,NN[h|m|s]。 -``` - -*示例: 生成一个对一个对象有4小时访问权限的URL。* - -``` - -mc share download --expire 4h play/mybucket/myobject.txt -URL: https://play.min.io/mybucket/myobject.txt -Expire: 0 days 4 hours 0 minutes 0 seconds -Share: https://play.min.io/mybucket/myobject.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=Q3AM3UQ867SPQQA43P2F%2F20160408%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20160408T182008Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=1527fc8f21a3a7e39ce3c456907a10b389125047adc552bcd86630b9d459b634 - -``` - -#### 子命令`share upload` - 共享上传 -`share upload`命令生成不需要access key和secret key即可上传的URL。过期参数设置成最大有效期(不大于7天),过期之后权限自动回收。 -Content-type参数限制只允许上传指定类型的文件。 - -``` -用法: - mc share upload [FLAGS] TARGET [TARGET...] - -FLAGS: - --help, -h 显示帮助。 - --recursive, -r 递归共享所有对象。 - --expire, -E "168h" 设置过期时限,NN[h|m|s]. -``` - -*示例: 生成一个`curl`命令,赋予上传到`play/mybucket/myotherobject.txt`的权限。* - -``` -mc share upload play/mybucket/myotherobject.txt -URL: https://play.min.io/mybucket/myotherobject.txt -Expire: 7 days 0 hours 0 minutes 0 seconds -Share: curl https://play.min.io/mybucket -F x-amz-date=20160408T182356Z -F x-amz-signature=de343934bd0ba38bda0903813b5738f23dde67b4065ea2ec2e4e52f6389e51e1 -F bucket=mybucket -F policy=eyJleHBpcmF0aW9uIjoiMjAxNi0wNC0xNVQxODoyMzo1NS4wMDdaIiwiY29uZGl0aW9ucyI6W1siZXEiLCIkYnVja2V0IiwibXlidWNrZXQiXSxbImVxIiwiJGtleSIsIm15b3RoZXJvYmplY3QudHh0Il0sWyJlcSIsIiR4LWFtei1kYXRlIiwiMjAxNjA0MDhUMTgyMzU2WiJdLFsiZXEiLCIkeC1hbXotYWxnb3JpdGhtIiwiQVdTNC1ITUFDLVNIQTI1NiJdLFsiZXEiLCIkeC1hbXotY3JlZGVudGlhbCIsIlEzQU0zVVE4NjdTUFFRQTQzUDJGLzIwMTYwNDA4L3VzLWVhc3QtMS9zMy9hd3M0X3JlcXVlc3QiXV19 -F x-amz-algorithm=AWS4-HMAC-SHA256 -F x-amz-credential=Q3AM3UQ867SPQQA43P2F/20160408/us-east-1/s3/aws4_request -F key=myotherobject.txt -F file=@ -``` - -#### 子命令`share list` - 列出之前的共享 -`share list`列出没未过期的共享URL。 - -``` -用法: - mc share list COMMAND - -COMMAND: - upload: 列出先前共享的有上传权限的URL。 - download: 列出先前共享的有下载权限的URL。 -``` - - -### `mirror`命令 - 存储桶镜像 -`mirror`命令和`rsync`类似,只不过它是在文件系统和对象存储之间做同步。 - -``` -用法: - mc mirror [FLAGS] SOURCE TARGET - -FLAGS: - --help, -h 显示帮助。 - --force 强制覆盖已经存在的目标。 - --fake 模拟一个假的操作。 - --watch, -w 监听改变并执行镜像操作。 - --remove 删除目标上的外部的文件。 -``` - -*示例: 将一个本地文件夹镜像到https://play.min.io上的'mybucket'存储桶。* - -``` -mc mirror localdir/ play/mybucket -localdir/b.txt: 40 B / 40 B ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00 % 73 B/s 0 -``` - -*示例: 持续监听本地文件夹修改并镜像到https://play.min.io上的'mybucket'存储桶。* - -``` -mc mirror -w localdir play/mybucket -localdir/new.txt: 10 MB / 10 MB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00 % 1 MB/s 15s -``` - - -### `find`命令 - 查找文件和对象 -``find``命令通过指定参数查找文件,它只列出满足条件的数据。 - -``` -用法: - mc find PATH [FLAGS] - -FLAGS: - --help, -h 显示帮助。 - --exec value 为每个匹配对象生成一个外部进程(请参阅FORMAT) - --name value 查找匹配通配符模式的对象。 - ... - ... -``` - -*示例: 持续从s3存储桶中查找所有jpeg图像,并复制到minio "play/bucket"存储桶* -``` -mc find s3/bucket --name "*.jpg" --watch --exec "mc cp {} play/bucket" -``` - - -### `diff`命令 - 显示差异 -``diff``命令计算两个目录之间的差异。它只列出缺少的或者大小不同的内容。 - -它*不*比较内容,所以可能的是,名称相同,大小相同但内容不同的对象没有被检测到。这样,它可以在不同站点或者大量数据的情况下快速比较。 - -``` -用法: - mc diff [FLAGS] FIRST SECOND - -FLAGS: - --help, -h 显示帮助。 -``` - -*示例: 比较一个本地文件夹和一个远程对象存储服务* - -``` - mc diff localdir play/mybucket -‘localdir/notes.txt’ and ‘https://play.min.io/mybucket/notes.txt’ - only in first. -``` - - -### `watch`命令 - 监听文件和对象存储事件。 -``watch``命令提供了一种方便监听对象存储和文件系统上不同类型事件的方式。 - -``` -用法: - mc watch [FLAGS] PATH - -FLAGS: - --events value 过滤不同类型的事件,默认是所有类型的事件 (默认: "put,delete,get") - --prefix value 基于前缀过滤事件。 - --suffix value 基于后缀过滤事件。 - --recursive 递归方式监听事件。 - --help, -h 显示帮助。 -``` - -*示例: 监听对象存储的所有事件* - -``` -mc watch play/testbucket -[2016-08-18T00:51:29.735Z] 2.7KiB ObjectCreated https://play.min.io/testbucket/CONTRIBUTING.md -[2016-08-18T00:51:29.780Z] 1009B ObjectCreated https://play.min.io/testbucket/MAINTAINERS.md -[2016-08-18T00:51:29.839Z] 6.9KiB ObjectCreated https://play.min.io/testbucket/README.md -``` - -*示例: 监听本地文件夹的所有事件* - -``` -mc watch ~/Photos -[2016-08-17T17:54:19.565Z] 3.7MiB ObjectCreated /home/minio/Downloads/tmp/5467026530_a8611b53f9_o.jpg -[2016-08-17T17:54:19.565Z] 3.7MiB ObjectCreated /home/minio/Downloads/tmp/5467026530_a8611b53f9_o.jpg -... -[2016-08-17T17:54:19.565Z] 7.5MiB ObjectCreated /home/minio/Downloads/tmp/8771468997_89b762d104_o.jpg -``` - - -### `events`命令 - 管理存储桶事件通知。 -``events``提供了一种方便的配置存储桶的各种类型事件通知的方式。MinIO事件通知可以配置成使用 AMQP,Redis,ElasticSearch,NATS和PostgreSQL服务。MinIO configuration提供了如何配置的更多细节。 - -``` -用法: - mc events COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...] - -COMMANDS: - add 添加一个新的存储桶通知。 - remove 删除一个存储桶通知。使用'--force'可以删除所有存储桶通知。 - list 列出存储桶通知。 - -FLAGS: - --help, -h 显示帮助。 -``` - -*示例: 列出所有存储桶通知。* - -``` -mc events list play/andoria -MyTopic arn:minio:sns:us-east-1:1:TestTopic s3:ObjectCreated:*,s3:ObjectRemoved:* suffix:.jpg -``` - -*示例: 添加一个新的'sqs'通知,仅接收ObjectCreated事件。* - -``` -mc events add play/andoria arn:minio:sqs:us-east-1:1:your-queue --events put -``` - -*示例: 添加一个带有过滤器的'sqs'通知。* - -给`sqs`通知添加`prefix`和`suffix`过滤规则。 - -``` -mc events add play/andoria arn:minio:sqs:us-east-1:1:your-queue --prefix photos/ --suffix .jpg -``` - -*示例: 删除一个'sqs'通知* - -``` -mc events remove play/andoria arn:minio:sqs:us-east-1:1:your-queue -``` - - -### `policy`命令 - 管理存储桶策略 -管理匿名访问存储桶和其内部内容的策略。 - -``` -用法: - mc policy [FLAGS] PERMISSION TARGET - mc policy [FLAGS] TARGET - mc policy list [FLAGS] TARGET - -PERMISSION: - Allowed policies are: [none, download, upload, public]. - -FLAGS: - --help, -h 显示帮助。 -``` - -*示例: 显示当前匿名存储桶策略* - -显示当前``mybucket/myphotos/2020/``子文件夹的匿名策略。 - -``` -mc policy play/mybucket/myphotos/2020/ -Access permission for ‘play/mybucket/myphotos/2020/’ is ‘none’ -``` - -*示例:设置可下载的匿名存储桶策略。* - -设置``mybucket/myphotos/2020/``子文件夹可匿名下载的策略。现在,这个文件夹下的对象可被公开访问。比如:``mybucket/myphotos/2020/yourobjectname``可通过这个URL [https://play.min.io/mybucket/myphotos/2020/yourobjectname](https://play.min.io/mybucket/myphotos/2020/yourobjectname)访问。 - -``` -mc policy set download play/mybucket/myphotos/2020/ -Access permission for ‘play/mybucket/myphotos/2020/’ is set to 'download' -``` - -*示例:删除当前的匿名存储桶策略* - -删除所有*mybucket/myphotos/2020/*这个子文件夹下的匿名存储桶策略。 - -``` -mc policy set none play/mybucket/myphotos/2020/ -Access permission for ‘play/mybucket/myphotos/2020/’ is set to 'none' -``` - - -### `config`命令 - 管理配置文件 -`config host`命令提供了一个方便地管理`~/.mc/config.json`配置文件中的主机信息的方式,你也可以用文本编辑器手动修改这个配置文件。 - -``` -用法: - mc config host COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...] - -COMMANDS: - add, a 添加一个新的主机到配置文件。 - remove, rm 从配置文件中删除一个主机。 - list, ls 列出配置文件中的主机。 - -FLAGS: - --help, -h 显示帮助。 -``` - -*示例: 管理配置文件* - -添加MinIO服务的access和secret key到配置文件,注意,shell的history特性可能会记录这些信息,从而带来安全隐患。在`bash` shell,使用`set -o`和`set +o`来关闭和开启history特性。 - -``` -set +o history -mc alias set myminio http://localhost:9000 OMQAGGOL63D7UNVQFY8X GcY5RHNmnEWvD/1QxD3spEIGj+Vt9L7eHaAaBTkJ -set -o history -``` - - -### `update`命令 - 软件更新 -从[https://dl.min.io](https://dl.min.io)检查软件更新。Experimental标志会检查unstable实验性的版本,通常用作测试用途。 - -``` -用法: - mc update [FLAGS] - -FLAGS: - --quiet, -q 关闭控制台输出。 - --json 使用JSON格式输出。 - --help, -h 显示帮助。 -``` - -*示例: 检查更新* - -``` -mc update -You are already running the most recent version of ‘mc’. -``` - - -### `version`命令 - 显示版本信息 -显示当前安装的`mc`版本。 - -``` -用法: - mc version [FLAGS] - -FLAGS: - --quiet, -q 关闭控制台输出。 - --json 使用JSON格式输出。 - --help, -h 显示帮助。 -``` - - *示例: 输出mc版本。* - -``` -mc version -Version: 2016-04-01T00:22:11Z -Release-tag: RELEASE.2016-04-01T00-22-11Z -Commit-id: 12adf3be326f5b6610cdd1438f72dfd861597fce -``` diff --git a/docs/zh_CN/minio-client-configuration-files.md b/docs/zh_CN/minio-client-configuration-files.md deleted file mode 100644 index a43f6df7..00000000 --- a/docs/zh_CN/minio-client-configuration-files.md +++ /dev/null @@ -1,80 +0,0 @@ -# MinIO Client配置文件指南 [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/minio/minio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -本文我们将详细介绍MinIO Client的配置文件。 - -## MinIO Client配置目录 -MinIO Client配置信息存储在``.mc``文件夹,它是用户home目录下的一个隐藏文件夹。 - -**这就是配置文件夹的目录结构:** - -``` -tree ~/.mc -/home/supernova/.mc -├── config.json -├── session -└── share -2 directories, 5 files -``` -### 文件和目录 - -#### ``session``目录 -``session``目录保存所有不完整上传或镜像的元数据信息。你可以运行`mc session list``列出这些信息。 - -#### ``config.json`` -config.json是MinIO Client的配置文件,它在安装并启动MinIO后生成。我们通过``mc config host``添加的所有凭证,endpoint信息都存储在这里。 - -``` -cat config.json -{ - "version": "8", - "hosts": { - "XL": { - "url": "http://127.0.0.1:9000", - "accessKey": "YI7S1CKXB76RGOGT6R8W", - "secretKey": "FJ9PWUVNXGPfiI72WMRFepN3LsFgW3MjsxSALroV", - "api": "S3v4" - }, - "fs": { - "url": "http://127.0.0.1:9000", - "accessKey": "YI7S1CKXB76RGOGT6R8W", - "secretKey": "FJ9PWUVNXGPfiI72WMRFepN3LsFgW3MjsxSALroV", - "api": "S3v4" - }, - "gcs": { - "url": "https://storage.googleapis.com", - "accessKey": "YOUR-ACCESS-KEY-HERE", - "secretKey": "YOUR-SECRET-KEY-HERE", - "api": "S3v2" - }, - "play": { - "url": "https://play.min.io", - "accessKey": "Q3AM3UQ867SPQQA43P2F", - "secretKey": "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", - "api": "S3v4" - }, - "s3": { - "url": "https://s3.amazonaws.com", - "accessKey": "YOUR-ACCESS-KEY-HERE", - "secretKey": "YOUR-SECRET-KEY-HERE", - "api": "S3v4" - } - } -} -``` - -``version``代表的是这个文件的版本。 - -``hosts``存储将被MinIO Client使用的认证证书。 - -#### ``config.json.old`` -这个文件保存了以前的配置文件版本细节。 - -#### ``share``目录 -``share``目录保存MinIO Client ``mc share``命令使用的所有对象的上传和下载URL的元数据信息。 - -## 了解更多 -* [MinIO Client完全指南](https://docs.min.io/docs/minio-client-complete-guide) - - - -