本文整理汇总了Python中minio.Minio.set_bucket_notification方法的典型用法代码示例。如果您正苦于以下问题:Python Minio.set_bucket_notification方法的具体用法?Python Minio.set_bucket_notification怎么用?Python Minio.set_bucket_notification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类minio.Minio
的用法示例。
在下文中一共展示了Minio.set_bucket_notification方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_notification_config_id_key_is_optional
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
def test_notification_config_id_key_is_optional(self, mock_connection):
mock_server = MockConnection()
mock_connection.return_value = mock_server
mock_server.mock_add_request(
MockResponse(
'PUT',
'https://localhost:9000/my-test-bucket/?notification=',
{
'Content-Md5': 'f+TfVp/A4pNnI7S4S+MkFg==',
'Content-Length': '196',
'User-Agent': _DEFAULT_USER_AGENT,
},
200, content=""
)
)
client = Minio('localhost:9000')
client.set_bucket_notification(
'my-test-bucket',
{
'QueueConfigurations': [
{
'Arn': 'arn1',
'Events': ['s3:ObjectCreated:*'],
}
]
}
)
示例2: test_notification_config_events_key_is_present
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
def test_notification_config_events_key_is_present(self):
client = Minio('localhost:9000')
client.set_bucket_notification(
'my-test-bucket',
{
'QueueConfigurations': [
{
'Id': '1',
'Arn': 'arn1',
}
]
}
)
示例3: test_notification_config_arn_key_is_present
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
def test_notification_config_arn_key_is_present(self):
client = Minio('localhost:9000')
client.set_bucket_notification(
'my-test-bucket',
{
'QueueConfigurations': [
{
'Id': '1',
'Events': ['s3:ObjectCreated:*'],
}
]
}
)
示例4: test_notification_config_id_key_is_string
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
def test_notification_config_id_key_is_string(self):
client = Minio('localhost:9000')
client.set_bucket_notification(
'my-test-bucket',
{
'QueueConfigurations': [
{
'Id': 1,
'Arn': 'abc',
'Events': ['s3:ObjectCreated:*'],
}
]
}
)
示例5: test_notification_config_has_valid_keys
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
def test_notification_config_has_valid_keys(self):
client = Minio('localhost:9000')
client.set_bucket_notification(
'my-test-bucket',
{
'QueueConfiguration': [
{
'Id': '1',
'Arn': 'arn1',
'Events': ['s3:ObjectCreated:*'],
}
]
}
)
示例6: test_notification_config_has_valid_event_names
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
def test_notification_config_has_valid_event_names(self):
client = Minio('localhost:9000')
client.set_bucket_notification(
'my-test-bucket',
{
'QueueConfigurations': [
{
'Id': '1',
'Arn': 'arn1',
'Events': ['object_created'],
}
]
}
)
示例7: test_notification_config_filterspec_is_valid_1
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
def test_notification_config_filterspec_is_valid_1(self):
client = Minio('localhost:9000')
client.set_bucket_notification(
'my-test-bucket',
{
'QueueConfigurations': [
{
'Id': '1',
'Arn': 'arn1',
'Events': ['s3:ObjectCreated:*'],
'Filter': []
}
]
}
)
示例8: test_notification_config_filterspec_is_valid_8
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
def test_notification_config_filterspec_is_valid_8(self, mock_connection):
mock_server = MockConnection()
mock_connection.return_value = mock_server
mock_server.mock_add_request(
MockResponse(
'PUT',
'https://localhost:9000/my-test-bucket/?notification=',
{
'Content-Length': '206',
'Content-Md5': 'AGCNfbD5OuiyIJFd+r67MA==',
'User-Agent': _DEFAULT_USER_AGENT,
},
200, content=""
)
)
client = Minio('localhost:9000')
client.set_bucket_notification(
'my-test-bucket',
{
'QueueConfigurations': [
{
'Id': '1',
'Arn': 'arn1',
'Events': ['s3:ObjectCreated:*'],
'Filter': {
'Key': {
'FilterRules': [
{
'Name': 'suffix',
'Value': 'abc'
}
]
}
}
}
]
}
)
示例9: test_notification_config_is_nonempty
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
def test_notification_config_is_nonempty(self):
client = Minio('localhost:9000')
client.set_bucket_notification(
'my-test-bucket',
{}
)
示例10: test_notification_is_dict_2
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
def test_notification_is_dict_2(self):
client = Minio('localhost:9000')
client.set_bucket_notification('my-test-bucket', ['myconfig1'])
示例11: test_notification_is_dict_1
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
def test_notification_is_dict_1(self):
client = Minio('localhost:9000')
client.set_bucket_notification('my-test-bucket', 'abc')
示例12: print
# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import set_bucket_notification [as 别名]
}
}
}
],
'CloudFunctionConfigurations': [
{
'Arn': 'arn3',
'Events': ['s3:ObjectRemoved:*'],
'Filter': {
'Key': {
'FilterRules': [
{
'Name': 'suffix',
'Value': '.jpg'
}
]
}
}
}
]
}
try:
client.set_bucket_notification('my-bucketname', notification)
except ResponseError as err:
# handle error response from service.
print(err)
except (ArgumentError, TypeError) as err:
# should happen only during development. Fix the notification argument
print(err)