Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: third_party/gsutil/gslib/commands/web.py

Issue 1380943003: Roll version of gsutil to 4.15. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/gsutil/gslib/commands/version.py ('k') | third_party/gsutil/gslib/copy_helper.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # Copyright 2012 Google Inc. All Rights Reserved. 2 # Copyright 2012 Google Inc. All Rights Reserved.
3 # 3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License. 5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at 6 # You may obtain a copy of the License at
7 # 7 #
8 # http://www.apache.org/licenses/LICENSE-2.0 8 # http://www.apache.org/licenses/LICENSE-2.0
9 # 9 #
10 # Unless required by applicable law or agreed to in writing, software 10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, 11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and 13 # See the License for the specific language governing permissions and
14 # limitations under the License. 14 # limitations under the License.
15 """Implementation of website configuration command for buckets.""" 15 """Implementation of website configuration command for buckets."""
16 16
17 from __future__ import absolute_import 17 from __future__ import absolute_import
18 18
19 import getopt
20 import sys 19 import sys
21 20
22 from apitools.base.py import encoding 21 from apitools.base.py import encoding
23 22
24 from gslib.command import Command 23 from gslib.command import Command
25 from gslib.command_argument import CommandArgument 24 from gslib.command_argument import CommandArgument
26 from gslib.cs_api_map import ApiSelector 25 from gslib.cs_api_map import ApiSelector
27 from gslib.exception import CommandException 26 from gslib.exception import CommandException
28 from gslib.help_provider import CreateHelpText 27 from gslib.help_provider import CreateHelpText
29 from gslib.third_party.storage_apitools import storage_v1_messages as apitools_m essages 28 from gslib.third_party.storage_apitools import storage_v1_messages as apitools_m essages
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 For example, suppose your company's Domain name is example.com. You could set 82 For example, suppose your company's Domain name is example.com. You could set
84 up a website bucket as follows: 83 up a website bucket as follows:
85 84
86 1. Create a bucket called example.com (see the "DOMAIN NAMED BUCKETS" 85 1. Create a bucket called example.com (see the "DOMAIN NAMED BUCKETS"
87 section of "gsutil help naming" for details about creating such buckets). 86 section of "gsutil help naming" for details about creating such buckets).
88 87
89 2. Create index.html and 404.html files and upload them to the bucket. 88 2. Create index.html and 404.html files and upload them to the bucket.
90 89
91 3. Configure the bucket to have website behavior using the command: 90 3. Configure the bucket to have website behavior using the command:
92 91
93 gsutil web set -m index.html -e 404.html gs://example.com 92 gsutil web set -m index.html -e 404.html gs://www.example.com
94 93
95 4. Add a DNS CNAME record for example.com pointing to c.storage.googleapis.com 94 4. Add a DNS CNAME record for example.com pointing to c.storage.googleapis.com
96 (ask your DNS administrator for help with this). 95 (ask your DNS administrator for help with this).
97 96
98 Now if you open a browser and navigate to http://example.com, it will display 97 Now if you open a browser and navigate to http://www.example.com, it will
99 the main page instead of the default bucket listing. Note: It can take time 98 display the main page instead of the default bucket listing. Note: It can
100 for DNS updates to propagate because of caching used by the DNS, so it may 99 take time for DNS updates to propagate because of caching used by the DNS,
101 take up to a day for the domain-named bucket website to work after you create 100 so it may take up to a day for the domain-named bucket website to work after
102 the CNAME DNS record. 101 you create the CNAME DNS record.
103 102
104 Additional notes: 103 Additional notes:
105 104
106 1. Because the main page is only served when a bucket listing request is made 105 1. Because the main page is only served when a bucket listing request is made
107 via the CNAME alias, you can continue to use "gsutil ls" to list the bucket 106 via the CNAME alias, you can continue to use "gsutil ls" to list the bucket
108 and get the normal bucket listing (rather than the main page). 107 and get the normal bucket listing (rather than the main page).
109 108
110 2. The main_page_suffix applies to each subdirectory of the bucket. For 109 2. The main_page_suffix applies to each subdirectory of the bucket. For
111 example, with the main_page_suffix configured to be index.html, a GET 110 example, with the main_page_suffix configured to be index.html, a GET
112 request for http://example.com would retrieve 111 request for http://www.example.com would retrieve
113 http://example.com/index.html, and a GET request for 112 http://www.example.com/index.html, and a GET request for
114 http://example.com/photos would retrieve 113 http://www.example.com/photos would retrieve
115 http://example.com/photos/index.html. 114 http://www.example.com/photos/index.html.
116 115
117 3. There is just one 404.html page: For example, a GET request for 116 3. There is just one 404.html page: For example, a GET request for
118 http://example.com/photos/missing would retrieve 117 http://www.example.com/photos/missing would retrieve
119 http://example.com/404.html, not http://example.com/photos/404.html. 118 http://www.example.com/404.html, not
119 http://www.example.com/photos/404.html.
120 120
121 4. For additional details see 121 4. For additional details see
122 https://developers.google.com/storage/docs/website-configuration. 122 https://developers.google.com/storage/docs/website-configuration.
123 123
124 The web command has two sub-commands: 124 The web command has two sub-commands:
125 """ + _SET_DESCRIPTION + _GET_DESCRIPTION 125 """ + _SET_DESCRIPTION + _GET_DESCRIPTION
126 126
127 _DETAILED_HELP_TEXT = CreateHelpText(_SYNOPSIS, _DESCRIPTION) 127 _DETAILED_HELP_TEXT = CreateHelpText(_SYNOPSIS, _DESCRIPTION)
128 128
129 _get_help_text = CreateHelpText(_GET_SYNOPSIS, _GET_DESCRIPTION) 129 _get_help_text = CreateHelpText(_GET_SYNOPSIS, _GET_DESCRIPTION)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 self.ParseSubOpts(check_args=True) 222 self.ParseSubOpts(check_args=True)
223 if action_subcommand == 'get': 223 if action_subcommand == 'get':
224 func = self._GetWeb 224 func = self._GetWeb
225 elif action_subcommand == 'set': 225 elif action_subcommand == 'set':
226 func = self._SetWeb 226 func = self._SetWeb
227 else: 227 else:
228 raise CommandException(('Invalid subcommand "%s" for the %s command.\n' 228 raise CommandException(('Invalid subcommand "%s" for the %s command.\n'
229 'See "gsutil help web".') % 229 'See "gsutil help web".') %
230 (action_subcommand, self.command_name)) 230 (action_subcommand, self.command_name))
231 return func() 231 return func()
OLDNEW
« no previous file with comments | « third_party/gsutil/gslib/commands/version.py ('k') | third_party/gsutil/gslib/copy_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698