本文整理汇总了Python中oslo_middleware.cors.set_defaults方法的典型用法代码示例。如果您正苦于以下问题:Python cors.set_defaults方法的具体用法?Python cors.set_defaults怎么用?Python cors.set_defaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oslo_middleware.cors
的用法示例。
在下文中一共展示了cors.set_defaults方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_cors_middleware_defaults
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_cors_middleware_defaults():
"""Update default configuration options for oslo.middleware."""
cors.set_defaults(
allow_headers=['X-Auth-Token',
'X-Identity-Status',
'X-Roles',
'X-Service-Catalog',
'X-User-Id',
'X-Project-Id',
'X-OpenStack-Request-ID',
'X-Server-Management-Url'],
expose_headers=['X-Auth-Token',
'X-Subject-Token',
'X-Service-Token',
'X-OpenStack-Request-ID',
'X-Server-Management-Url'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH'])
示例2: set_defaults
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_defaults():
"""Override all default values from upstream packages"""
cors.set_defaults(
allow_headers=['X-Auth-Token',
'X-Auth-Sudo-Tenant-ID',
'X-Auth-Sudo-Project-ID',
'X-Auth-All-Projects',
'X-Designate-Edit-Managed-Records',
'OpenStack-DNS-Hide-Counts'],
expose_headers=['X-OpenStack-Request-ID',
'Host'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH',
'HEAD']
)
示例3: set_cors_middleware_defaults
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_cors_middleware_defaults():
"""Update default configuration options for oslo.middleware."""
cors.set_defaults(
allow_headers=['X-Auth-Token',
'X-Identity-Status',
'X-Roles',
'X-Service-Catalog',
'X-User-Id',
'X-Tenant-Id',
'X-OpenStack-Request-ID',
'X-Server-Management-Url'],
expose_headers=['X-Auth-Token',
'X-Subject-Token',
'X-Service-Token',
'X-OpenStack-Request-ID',
'X-Server-Management-Url'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH']
)
示例4: set_middleware_defaults
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_middleware_defaults():
"""Update default configuration options for oslo.middleware."""
cors.set_defaults(
allow_headers=['X-Auth-Token',
'X-OpenStack-Request-ID',
'X-Openstack-Manila-Api-Version',
'X-OpenStack-Manila-API-Experimental',
'X-Identity-Status',
'X-Roles',
'X-Service-Catalog',
'X-User-Id',
'X-Tenant-Id'],
expose_headers=['X-Auth-Token',
'X-OpenStack-Request-ID',
'X-Openstack-Manila-Api-Version',
'X-OpenStack-Manila-API-Experimental',
'X-Subject-Token',
'X-Service-Token'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH']
)
示例5: set_cors_middleware_defaults
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_cors_middleware_defaults():
"""Update default configuration options for oslo.middleware."""
cors.set_defaults(
allow_headers=['X-Auth-Token',
'X-Subject-Token',
'X-Roles',
'X-User-Id',
'X-Domain-Id',
'X-Project-Id',
'X-Tenant-Id',
'X-OpenStack-Request-ID'],
expose_headers=['X-Auth-Token',
'X-Subject-Token',
'X-Service-Token',
'X-OpenStack-Request-ID'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH'])
示例6: set_config_defaults
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_config_defaults():
"""Update default configuration options for oslo.middleware."""
cors.set_defaults(
allow_headers=['X-Auth-Token',
'X-Identity-Status',
'X-Roles',
'X-Service-Catalog',
'X-User-Id',
'X-Tenant-Id',
'X-OpenStack-Request-ID'],
expose_headers=['X-Auth-Token',
'X-Subject-Token',
'X-Service-Token',
'X-OpenStack-Request-ID'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH'])
示例7: set_cors_middleware_defaults
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_cors_middleware_defaults():
"""Update default configuration options for oslo.middleware."""
cors.set_defaults(
allow_headers=['X-Auth-Token',
'X-Identity-Status',
'X-Roles',
'X-Service-Catalog',
'X-User-Id',
'X-Tenant-Id',
'X-Project-Id',
'X-User-Name',
'X-Project-Name'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH'],
expose_headers=['X-Auth-Token',
'X-Subject-Token',
'X-Service-Token',
'X-Project-Id',
'X-User-Name',
'X-Project-Name']
)
示例8: parse_args
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def parse_args(argv, default_config_files=None):
rpc.set_defaults(control_exchange='zun')
init(argv[1:], default_config_files=default_config_files)
rpc.init(zun.conf.CONF)
示例9: _wrap_app
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def _wrap_app(app):
"""Wraps wsgi app with additional middlewares."""
app = request_id.RequestId(app)
if CONF.audit.enabled:
try:
app = audit_middleware.AuditMiddleware(
app,
audit_map_file=CONF.audit.audit_map_file,
ignore_req_list=CONF.audit.ignore_req_list
)
except (EnvironmentError, OSError,
audit_middleware.PycadfAuditApiConfigError) as e:
raise exceptions.InputFileError(
file_name=CONF.audit.audit_map_file,
reason=e
)
if cfg.CONF.api_settings.auth_strategy == constants.KEYSTONE:
app = keystone.SkippingAuthProtocol(app, {})
app = http_proxy_to_wsgi.HTTPProxyToWSGI(app)
# This should be the last middleware in the list (which results in
# it being the first in the middleware chain). This is to ensure
# that any errors thrown by other middleware, such as an auth
# middleware - are annotated with CORS headers, and thus accessible
# by the browser.
app = cors.CORS(app, cfg.CONF)
cors.set_defaults(
allow_headers=['X-Auth-Token', 'X-Openstack-Request-Id'],
allow_methods=['GET', 'PUT', 'POST', 'DELETE'],
expose_headers=['X-Auth-Token', 'X-Openstack-Request-Id']
)
return app
示例10: parse_args
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def parse_args(argv, default_config_files=None):
rpc.set_defaults(control_exchange='magnum')
CONF(argv[1:],
project='magnum',
version=version.version_info.release_string(),
default_config_files=default_config_files)
rpc.init(CONF)
示例11: test_config_defaults
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def test_config_defaults(self):
"""Assert that using set_defaults overrides the appropriate values."""
cors.set_defaults(**self.override_opts)
for opt in cors.CORS_OPTS:
if opt.dest in self.override_opts:
self.assertEqual(self.override_opts[opt.dest], opt.default)
示例12: test_invalid_default_option
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def test_invalid_default_option(self):
"""Assert that using set_defaults only permits valid options."""
self.assertRaises(AttributeError,
cors.set_defaults,
allowed_origin='test')
示例13: set_middleware_defaults
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_middleware_defaults():
"""Update default configuration options for oslo.middleware."""
cors.set_defaults(
allow_headers=['X-Auth-Token',
'X-Openstack-Request-Id',
'X-Project-Id',
'X-Identity-Status',
'X-User-Id',
'X-Storage-Token',
'X-Domain-Id',
'X-User-Domain-Id',
'X-Project-Domain-Id',
'X-Roles'],
expose_headers=['X-Auth-Token',
'X-Openstack-Request-Id',
'X-Project-Id',
'X-Identity-Status',
'X-User-Id',
'X-Storage-Token',
'X-Domain-Id',
'X-User-Domain-Id',
'X-Project-Domain-Id',
'X-Roles'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH']
)
示例14: parse_args
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def parse_args(argv, name, default_config_files=None):
log.register_options(CONF)
if profiler:
profiler.set_defaults(CONF)
set_config_defaults()
CONF(
argv[1:],
project='senlin',
prog=name,
version=version.version_info.version_string(),
default_config_files=default_config_files,
)
示例15: set_config_defaults
# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_config_defaults():
"""Return a list of oslo.config options available in Inspector code."""
log.set_defaults(default_log_levels=['sqlalchemy=WARNING',
'iso8601=WARNING',
'requests=WARNING',
'urllib3.connectionpool=WARNING',
'keystonemiddleware=WARNING',
'keystoneauth=WARNING',
'ironicclient=WARNING',
'amqp=WARNING',
'amqplib=WARNING',
# This comes in two flavors
'oslo.messaging=WARNING',
'oslo_messaging=WARNING'])
set_cors_middleware_defaults()