diff options
-rw-r--r-- | boto/auth.py | 2 | ||||
-rw-r--r-- | boto/cloudsearch2/layer1.py | 26 | ||||
-rw-r--r-- | boto/elasticache/layer1.py | 1 | ||||
-rw-r--r-- | boto/redshift/exceptions.py | 8 | ||||
-rw-r--r-- | boto/redshift/layer1.py | 551 | ||||
-rw-r--r-- | boto/ses/connection.py | 41 | ||||
-rw-r--r-- | boto/ses/exceptions.py | 5 | ||||
-rw-r--r-- | boto/support/exceptions.py | 24 | ||||
-rw-r--r-- | boto/support/layer1.py | 192 | ||||
-rw-r--r-- | tests/integration/elasticache/test_layer1.py | 6 | ||||
-rw-r--r-- | tests/integration/ses/test_connection.py | 2 | ||||
-rw-r--r-- | tests/unit/auth/test_sigv4.py | 11 | ||||
-rw-r--r-- | tests/unit/ses/test_identity.py | 1 |
13 files changed, 577 insertions, 293 deletions
diff --git a/boto/auth.py b/boto/auth.py index 6012962a..bc8290d7 100644 --- a/boto/auth.py +++ b/boto/auth.py @@ -317,6 +317,8 @@ class HmacAuthV4Handler(AuthHandler, HmacKeys): for name, value in http_request.headers.items(): lname = name.lower() if lname.startswith('x-amz'): + if isinstance(value, bytes): + value = value.decode('utf-8') headers_to_sign[name] = value return headers_to_sign diff --git a/boto/cloudsearch2/layer1.py b/boto/cloudsearch2/layer1.py index fdc9d4c6..0c41762f 100644 --- a/boto/cloudsearch2/layer1.py +++ b/boto/cloudsearch2/layer1.py @@ -21,11 +21,11 @@ # import boto +from boto.compat import json from boto.connection import AWSQueryConnection from boto.regioninfo import RegionInfo from boto.exception import JSONResponseError from boto.cloudsearch2 import exceptions -from boto.compat import json class CloudSearchConnection(AWSQueryConnection): @@ -56,6 +56,7 @@ class CloudSearchConnection(AWSQueryConnection): "BaseException": exceptions.BaseException, } + def __init__(self, **kwargs): region = kwargs.pop('region', None) if not region: @@ -110,10 +111,10 @@ class CloudSearchConnection(AWSQueryConnection): def define_analysis_scheme(self, domain_name, analysis_scheme): """ - Configures an analysis scheme for a domain. An analysis scheme - defines language-specific text processing options for a `text` - field. For more information, see `Configuring Analysis - Schemes`_ in the Amazon CloudSearch Developer Guide . + Configures an analysis scheme that can be applied to a `text` + or `text-array` field to define language-specific text + processing options. For more information, see `Configuring + Analysis Schemes`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. @@ -155,8 +156,8 @@ class CloudSearchConnection(AWSQueryConnection): :type expression: dict :param expression: A named expression that can be evaluated at search - time. Can be used for sorting and filtering search results and - constructing other expressions. + time. Can be used to sort the search results, define other + expressions, or return computed information in the search results. """ params = {'DomainName': domain_name, } @@ -425,9 +426,12 @@ class CloudSearchConnection(AWSQueryConnection): """ Gets information about the search domains owned by this account. Can be limited to specific domains. Shows all domains - by default. For more information, see `Getting Information - about a Search Domain`_ in the Amazon CloudSearch Developer - Guide . + by default. To get the number of searchable documents in a + domain, use the console or submit a `matchall` request to your + domain's search endpoint: + `q=matchall&q.parser=structured&size=0`. For more information, + see `Getting Information about a Search Domain`_ in the Amazon + CloudSearch Developer Guide . :type domain_names: list :param domain_names: The names of the domains you want to include in @@ -631,8 +635,6 @@ class CloudSearchConnection(AWSQueryConnection): def list_domain_names(self): """ Lists all search domains owned by an account. - - """ params = {} return self._make_request( diff --git a/boto/elasticache/layer1.py b/boto/elasticache/layer1.py index 59c43a3d..62bdefd1 100644 --- a/boto/elasticache/layer1.py +++ b/boto/elasticache/layer1.py @@ -58,7 +58,6 @@ class ElastiCacheConnection(AWSQueryConnection): super(ElastiCacheConnection, self).__init__(**kwargs) self.region = region - def _required_auth_capability(self): return ['hmac-v4'] diff --git a/boto/redshift/exceptions.py b/boto/redshift/exceptions.py index 0457dcd1..70339225 100644 --- a/boto/redshift/exceptions.py +++ b/boto/redshift/exceptions.py @@ -34,10 +34,6 @@ class ClusterSnapshotNotFoundFault(JSONResponseError): pass -class ClusterNotFoundFault(JSONResponseError): - pass - - class ClusterSecurityGroupQuotaExceededFault(JSONResponseError): pass @@ -457,3 +453,7 @@ class SnapshotCopyAlreadyEnabled(JSONResponseError): class IncompatibleOrderableOptions(JSONResponseError): pass + + +class InvalidSubscriptionState(JSONResponseError): + pass diff --git a/boto/redshift/layer1.py b/boto/redshift/layer1.py index 2317f5d2..be1529fd 100644 --- a/boto/redshift/layer1.py +++ b/boto/redshift/layer1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved +# Copyright (c) 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the @@ -20,8 +20,8 @@ # IN THE SOFTWARE. # -import json import boto +from boto.compat import json from boto.connection import AWSQueryConnection from boto.regioninfo import RegionInfo from boto.exception import JSONResponseError @@ -113,6 +113,7 @@ class RedshiftConnection(AWSQueryConnection): "InvalidS3KeyPrefix": exceptions.InvalidS3KeyPrefix, "SubscriptionAlreadyExist": exceptions.SubscriptionAlreadyExist, "HsmConfigurationNotFound": exceptions.HsmConfigurationNotFound, + "InvalidSubscriptionState": exceptions.InvalidSubscriptionState, "AuthorizationNotFound": exceptions.AuthorizationNotFound, "ClusterSecurityGroupQuotaExceeded": exceptions.ClusterSecurityGroupQuotaExceeded, "SubnetAlreadyInUse": exceptions.SubnetAlreadyInUse, @@ -140,8 +141,10 @@ class RedshiftConnection(AWSQueryConnection): if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) - if 'host' not in kwargs: + + if 'host' not in kwargs or kwargs['host'] is None: kwargs['host'] = region.endpoint + super(RedshiftConnection, self).__init__(**kwargs) self.region = region @@ -161,8 +164,7 @@ class RedshiftConnection(AWSQueryConnection): Routing (CIDR) IP address range or an EC2 security group. You can add as many as 20 ingress rules to an Amazon Redshift security group. - The EC2 security group must be defined in the AWS region where - the cluster resides. + For an overview of CIDR blocks, see the Wikipedia article on `Classless Inter-Domain Routing`_. @@ -269,7 +271,7 @@ class RedshiftConnection(AWSQueryConnection): + Must be the identifier for a valid automated snapshot whose state is - "available". + `available`. :type source_snapshot_cluster_identifier: string :param source_snapshot_cluster_identifier: @@ -386,7 +388,8 @@ class RedshiftConnection(AWSQueryConnection): :param node_type: The node type to be provisioned for the cluster. For information about node types, go to ` Working with Clusters`_ in the Amazon Redshift Management Guide . - Valid Values: `dw.hs1.xlarge` | `dw.hs1.8xlarge`. + Valid Values: `dw1.xlarge` | `dw1.8xlarge` | `dw2.large` | + `dw2.8xlarge`. :type master_username: string :param master_username: @@ -459,6 +462,10 @@ class RedshiftConnection(AWSQueryConnection): + **US-East (Northern Virginia) Region:** 03:00-11:00 UTC + **US-West (Oregon) Region** 06:00-14:00 UTC + + **EU (Ireland) Region** 22:00-06:00 UTC + + **Asia Pacific (Singapore) Region** 14:00-22:00 UTC + + **Asia Pacific (Sydney) Region** 12:00-20:00 UTC + + **Asia Pacific (Tokyo) Region** 17:00-03:00 UTC Valid Days: Mon | Tue | Wed | Thu | Fri | Sat | Sun @@ -541,7 +548,8 @@ class RedshiftConnection(AWSQueryConnection): a public network. :type encrypted: boolean - :param encrypted: If `True`, the data in cluster is encrypted at rest. + :param encrypted: If `True`, the data in the cluster is encrypted at + rest. Default: false :type hsm_client_certificate_identifier: string @@ -643,8 +651,7 @@ class RedshiftConnection(AWSQueryConnection): + Must be 1 to 255 alphanumeric characters or hyphens + First character must be a letter. + Cannot end with a hyphen or contain two consecutive hyphens. - + Must be unique withing your AWS account. - + + Must be unique within your AWS account. This value is stored as a lower-case string. @@ -680,7 +687,7 @@ class RedshiftConnection(AWSQueryConnection): Creates a new Amazon Redshift security group. You use security groups to control access to non-VPC clusters. - For information about managing security groups, go to`Amazon + For information about managing security groups, go to `Amazon Redshift Cluster Security Groups`_ in the Amazon Redshift Management Guide . @@ -715,7 +722,7 @@ class RedshiftConnection(AWSQueryConnection): cluster_identifier): """ Creates a manual snapshot of the specified cluster. The - cluster must be in the "available" state. + cluster must be in the `available` state. For more information about working with snapshots, go to `Amazon Redshift Snapshots`_ in the Amazon Redshift Management @@ -758,7 +765,7 @@ class RedshiftConnection(AWSQueryConnection): Private Cloud (Amazon VPC) when creating Amazon Redshift subnet group. - For information about subnet groups, go to`Amazon Redshift + For information about subnet groups, go to `Amazon Redshift Cluster Subnet Groups`_ in the Amazon Redshift Management Guide . @@ -815,13 +822,13 @@ class RedshiftConnection(AWSQueryConnection): those criteria. For example, you can specify source type = cluster, source ID = my-cluster-1 and mycluster2, event categories = Availability, Backup, and severity = ERROR. The - subsription will only send notifications for those ERROR - events in the Availability and Backup categores for the + subscription will only send notifications for those ERROR + events in the Availability and Backup categories for the specified clusters. If you specify both the source type and source IDs, such as source type = cluster and source identifier = my-cluster-1, - notifiactions will be sent for all the cluster events for my- + notifications will be sent for all the cluster events for my- cluster-1. If you specify a source type but do not specify a source identifier, you will receive notice of the events for the objects of that type in your AWS account. If you do not @@ -917,16 +924,16 @@ class RedshiftConnection(AWSQueryConnection): databases. The command returns a public key, which you must store in the - HSM. After creating the HSM certificate, you must create an - Amazon Redshift HSM configuration that provides a cluster the - information needed to store and retrieve database encryption - keys in the HSM. For more information, go to aLinkToHSMTopic - in the Amazon Redshift Management Guide. + HSM. In addition to creating the HSM certificate, you must + create an Amazon Redshift HSM configuration that provides a + cluster the information needed to store and use encryption + keys in the HSM. For more information, go to `Hardware + Security Modules`_ in the Amazon Redshift Management Guide. :type hsm_client_certificate_identifier: string :param hsm_client_certificate_identifier: The identifier to be assigned to the new HSM client certificate that the cluster will use to - connect to the HSM to retrieve the database encryption keys. + connect to the HSM to use the database encryption keys. """ params = { @@ -943,15 +950,16 @@ class RedshiftConnection(AWSQueryConnection): hsm_server_public_certificate): """ Creates an HSM configuration that contains the information - required by an Amazon Redshift cluster to store and retrieve - database encryption keys in a Hardware Storeage Module (HSM). + required by an Amazon Redshift cluster to store and use + database encryption keys in a Hardware Security Module (HSM). After creating the HSM configuration, you can specify it as a parameter when creating a cluster. The cluster will then store its encryption keys in the HSM. - Before creating an HSM configuration, you must have first - created an HSM client certificate. For more information, go to - aLinkToHSMTopic in the Amazon Redshift Management Guide. + In addition to creating an HSM configuration, you must also + create an HSM client certificate. For more information, go to + `Hardware Security Modules`_ in the Amazon Redshift Management + Guide. :type hsm_configuration_identifier: string :param hsm_configuration_identifier: The identifier to be assigned to @@ -975,9 +983,8 @@ class RedshiftConnection(AWSQueryConnection): partition. :type hsm_server_public_certificate: string - :param hsm_server_public_certificate: The public key used to access the - HSM client certificate, which was created by calling the Amazon - Redshift create HSM certificate command. + :param hsm_server_public_certificate: The HSMs public certificate file. + When using Cloud HSM, the file name is server.pem. """ params = { @@ -1026,9 +1033,6 @@ class RedshiftConnection(AWSQueryConnection): cluster. If `True`, a final cluster snapshot is not created. If `False`, a final cluster snapshot is created before the cluster is deleted. - The FinalClusterSnapshotIdentifier parameter must be specified if - SkipFinalClusterSnapshot is `False`. - Default: `False` :type final_cluster_snapshot_identifier: string @@ -1058,9 +1062,7 @@ class RedshiftConnection(AWSQueryConnection): def delete_cluster_parameter_group(self, parameter_group_name): """ - Deletes a specified Amazon Redshift parameter group. You - cannot delete a parameter group if it is associated with a - cluster. + Deletes a specified Amazon Redshift parameter group. :type parameter_group_name: string :param parameter_group_name: @@ -1082,9 +1084,8 @@ class RedshiftConnection(AWSQueryConnection): def delete_cluster_security_group(self, cluster_security_group_name): """ Deletes an Amazon Redshift security group. - You cannot delete a security group that is associated with any - clusters. You cannot delete the default security group. - For information about managing security groups, go to`Amazon + + For information about managing security groups, go to `Amazon Redshift Cluster Security Groups`_ in the Amazon Redshift Management Guide . @@ -1105,7 +1106,7 @@ class RedshiftConnection(AWSQueryConnection): snapshot_cluster_identifier=None): """ Deletes the specified manual snapshot. The snapshot must be in - the "available" state, with no other users authorized to + the `available` state, with no other users authorized to access the snapshot. Unlike automated snapshots, manual snapshots are retained even @@ -1224,19 +1225,23 @@ class RedshiftConnection(AWSQueryConnection): groups and the default parameter group are returned. :type max_records: integer - :param max_records: The maximum number of parameter group records to - include in the response. If more records exist than the specified - `MaxRecords` value, the response includes a marker that you can use - in a subsequent DescribeClusterParameterGroups request to retrieve - the next set of records. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` - Constraints: Value must be at least 20 and no more than 100. + Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned by a previous - DescribeClusterParameterGroups request to indicate the first - parameter group that the current request will return. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeClusterParameterGroups request exceed the value specified + in `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. """ params = {} @@ -1284,19 +1289,23 @@ class RedshiftConnection(AWSQueryConnection): Valid Values: `user` | `engine-default` :type max_records: integer - :param max_records: The maximum number of records to include in the - response. If more records exist than the specified `MaxRecords` - value, response includes a marker that you can specify in your - subsequent request to retrieve remaining result. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` - Constraints: Value must be at least 20 and no more than 100. + Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned from a previous - **DescribeClusterParameters** request. If this parameter is - specified, the response includes only records beyond the specified - marker, up to the value specified by `MaxRecords`. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeClusterParameters request exceed the value specified in + `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. """ params = {'ParameterGroupName': parameter_group_name, } @@ -1319,7 +1328,7 @@ class RedshiftConnection(AWSQueryConnection): the name of a security group is specified, the response will contain only information about only that security group. - For information about managing security groups, go to`Amazon + For information about managing security groups, go to `Amazon Redshift Cluster Security Groups`_ in the Amazon Redshift Management Guide . @@ -1331,20 +1340,25 @@ class RedshiftConnection(AWSQueryConnection): Example: `securitygroup1` :type max_records: integer - :param max_records: The maximum number of records to be included in the - response. If more records exist than the specified `MaxRecords` - value, a marker is included in the response, which you can use in a - subsequent DescribeClusterSecurityGroups request. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` - Constraints: Value must be at least 20 and no more than 100. + Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned by a previous - DescribeClusterSecurityGroups request to indicate the first - security group that the current request will return. You can - specify either the **Marker** parameter or a - **ClusterSecurityGroupName** parameter, but not both. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeClusterSecurityGroups request exceed the value specified in + `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. + Constraints: You can specify either the **ClusterSecurityGroupName** + parameter or the **Marker** parameter, but not both. """ params = {} @@ -1401,19 +1415,23 @@ class RedshiftConnection(AWSQueryConnection): Example: `2012-07-16T18:00:00Z` :type max_records: integer - :param max_records: The maximum number of snapshot records to include - in the response. If more records exist than the specified - `MaxRecords` value, the response returns a marker that you can use - in a subsequent DescribeClusterSnapshots request in order to - retrieve the next set of snapshot records. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` - Constraints: Must be at least 20 and no more than 100. + Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned by a previous - DescribeClusterSnapshots request to indicate the first snapshot - that the request will return. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeClusterSnapshots request exceed the value specified in + `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. :type owner_account: string :param owner_account: The AWS customer account used to create or copy @@ -1458,19 +1476,23 @@ class RedshiftConnection(AWSQueryConnection): for which information is requested. :type max_records: integer - :param max_records: The maximum number of cluster subnet group records - to include in the response. If more records exist than the - specified `MaxRecords` value, the response returns a marker that - you can use in a subsequent DescribeClusterSubnetGroups request in - order to retrieve the next set of cluster subnet group records. - Default: 100 + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. + Default: `100` - Constraints: Must be at least 20 and no more than 100. + Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned by a previous - DescribeClusterSubnetGroups request to indicate the first cluster - subnet group that the current request will return. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeClusterSubnetGroups request exceed the value specified in + `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. """ params = {} @@ -1512,18 +1534,23 @@ class RedshiftConnection(AWSQueryConnection): + Cannot end with a hyphen or contain two consecutive hyphens :type max_records: integer - :param max_records: The maximum number of records to include in the - response. If more than the `MaxRecords` value is available, a - marker is included in the response so that the following results - can be retrieved. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` - Constraints: Value must be at least 20 and no more than 100. + Constraints: minimum 20, maximum 100. :type marker: string - :param marker: The marker returned from a previous request. If this - parameter is specified, the response includes records beyond the - marker only, up to `MaxRecords`. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeClusterVersions request exceed the value specified in + `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. """ params = {} @@ -1552,25 +1579,29 @@ class RedshiftConnection(AWSQueryConnection): :type cluster_identifier: string :param cluster_identifier: The unique identifier of a cluster whose - properties you are requesting. This parameter isn't case sensitive. + properties you are requesting. This parameter is case sensitive. The default is that all clusters defined for an account are returned. :type max_records: integer - :param max_records: The maximum number of records that the response can - include. If more records exist than the specified `MaxRecords` - value, a `marker` is included in the response that can be used in a - new **DescribeClusters** request to continue listing results. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` - Constraints: Value must be at least 20 and no more than 100. + Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned by a previous - **DescribeClusters** request to indicate the first cluster that the - current **DescribeClusters** request will return. - You can specify either a **Marker** parameter or a - **ClusterIdentifier** parameter in a **DescribeClusters** request, - but not both. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeClusters request exceed the value specified in + `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. + Constraints: You can specify either the **ClusterIdentifier** parameter + or the **Marker** parameter, but not both. """ params = {} @@ -1600,19 +1631,23 @@ class RedshiftConnection(AWSQueryConnection): family. :type max_records: integer - :param max_records: The maximum number of records to include in the - response. If more records exist than the specified `MaxRecords` - value, a marker is included in the response so that the remaining - results may be retrieved. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` - Constraints: Value must be at least 20 and no more than 100. + Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned from a previous - **DescribeDefaultClusterParameters** request. If this parameter is - specified, the response includes only records beyond the marker, up - to the value specified by `MaxRecords`. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeDefaultClusterParameters request exceed the value specified + in `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. """ params = {'ParameterGroupFamily': parameter_group_family, } @@ -1659,19 +1694,23 @@ class RedshiftConnection(AWSQueryConnection): notification subscription to be described. :type max_records: integer - :param max_records: The maximum number of records to include in the - response. If more records exist than the specified MaxRecords - value, a pagination token called a marker is included in the - response so that the remaining results can be retrieved. - Default: 100 + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. + Default: `100` - Constraints: minimum 20, maximum 100 + Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional pagination token provided by a previous - DescribeOrderableClusterOptions request. If this parameter is - specified, the response includes only records beyond the marker, up - to the value specified by MaxRecords. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeEventSubscriptions request exceed the value specified in + `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. """ params = {} @@ -1753,19 +1792,22 @@ class RedshiftConnection(AWSQueryConnection): Default: `60` :type max_records: integer - :param max_records: The maximum number of records to include in the - response. If more records exist than the specified `MaxRecords` - value, a marker is included in the response so that the remaining - results may be retrieved. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` - Constraints: Value must be at least 20 and no more than 100. + Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned from a previous - **DescribeEvents** request. If this parameter is specified, the - response includes only records beyond the marker, up to the value - specified by `MaxRecords`. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeEvents request exceed the value specified in `MaxRecords`, + AWS returns a value in the `Marker` field of the response. You can + retrieve the next set of response records by providing the returned + marker value in the `Marker` parameter and retrying the request. """ params = {} @@ -1801,23 +1843,26 @@ class RedshiftConnection(AWSQueryConnection): :param hsm_client_certificate_identifier: The identifier of a specific HSM client certificate for which you want information. If no identifier is specified, information is returned for all HSM client - certificates associated with Amazon Redshift clusters owned by your - AWS customer account. + certificates owned by your AWS customer account. :type max_records: integer - :param max_records: The maximum number of records to include in the - response. If more records exist than the specified `MaxRecords` - value, a marker is included in the response so that the remaining - results may be retrieved. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned from a previous - **DescribeOrderableClusterOptions** request. If this parameter is - specified, the response includes only records beyond the marker, up - to the value specified by `MaxRecords`. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeHsmClientCertificates request exceed the value specified in + `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. """ params = {} @@ -1847,19 +1892,23 @@ class RedshiftConnection(AWSQueryConnection): owned by your AWS customer account. :type max_records: integer - :param max_records: The maximum number of records to include in the - response. If more records exist than the specified `MaxRecords` - value, a marker is included in the response so that the remaining - results may be retrieved. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned from a previous - **DescribeOrderableClusterOptions** request. If this parameter is - specified, the response includes only records beyond the marker, up - to the value specified by `MaxRecords`. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeHsmConfigurations request exceed the value specified in + `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. """ params = {} @@ -1921,19 +1970,23 @@ class RedshiftConnection(AWSQueryConnection): show only the available offerings matching the specified node type. :type max_records: integer - :param max_records: The maximum number of records to include in the - response. If more records exist than the specified `MaxRecords` - value, a marker is included in the response so that the remaining - results may be retrieved. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned from a previous - **DescribeOrderableClusterOptions** request. If this parameter is - specified, the response includes only records beyond the marker, up - to the value specified by `MaxRecords`. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeOrderableClusterOptions request exceed the value specified + in `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. """ params = {} @@ -1972,21 +2025,23 @@ class RedshiftConnection(AWSQueryConnection): offering. :type max_records: integer - :param max_records: The maximum number of records to include in the - response. If more records exist than the specified `MaxRecords` - value, a marker is included in the response so that the remaining - results may be retrieved. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned by a previous - DescribeReservedNodeOfferings request to indicate the first - offering that the request will return. - You can specify either a **Marker** parameter or a - **ClusterIdentifier** parameter in a DescribeClusters request, but - not both. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeReservedNodeOfferings request exceed the value specified in + `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. """ params = {} @@ -2010,18 +2065,23 @@ class RedshiftConnection(AWSQueryConnection): :param reserved_node_id: Identifier for the node reservation. :type max_records: integer - :param max_records: The maximum number of records to include in the - response. If more records exist than the specified `MaxRecords` - value, a marker is included in the response so that the remaining - results may be retrieved. + :param max_records: The maximum number of response records to return in + each call. If the number of remaining response records exceeds the + specified `MaxRecords` value, a value is returned in a `marker` + field of the response. You can retrieve the next set of records by + retrying the command with the returned marker value. Default: `100` Constraints: minimum 20, maximum 100. :type marker: string - :param marker: An optional marker returned by a previous - DescribeReservedNodes request to indicate the first parameter group - that the current request will return. + :param marker: An optional parameter that specifies the starting point + to return a set of response records. When the results of a + DescribeReservedNodes request exceed the value specified in + `MaxRecords`, AWS returns a value in the `Marker` field of the + response. You can retrieve the next set of response records by + providing the returned marker value in the `Marker` parameter and + retrying the request. """ params = {} @@ -2199,16 +2259,17 @@ class RedshiftConnection(AWSQueryConnection): preferred_maintenance_window=None, cluster_version=None, allow_version_upgrade=None, hsm_client_certificate_identifier=None, - hsm_configuration_identifier=None): + hsm_configuration_identifier=None, + new_cluster_identifier=None): """ Modifies the settings for a cluster. For example, you can add another security or parameter group, update the preferred maintenance window, or change the master user password. Resetting a cluster password or modifying the security groups associated with a cluster do not need a reboot. However, - modifying parameter group requires a reboot for parameters to - take effect. For more information about managing clusters, go - to `Amazon Redshift Clusters`_ in the Amazon Redshift + modifying a parameter group requires a reboot for parameters + to take effect. For more information about managing clusters, + go to `Amazon Redshift Clusters`_ in the Amazon Redshift Management Guide You can also change node type and the number of nodes to scale @@ -2247,7 +2308,8 @@ class RedshiftConnection(AWSQueryConnection): permissions for the cluster are restored. You can use the DescribeResize to track the progress of the resize request. - Valid Values: ` dw.hs1.xlarge` | `dw.hs1.8xlarge` + Valid Values: ` dw1.xlarge` | `dw1.8xlarge` | `dw2.large` | + `dw2.8xlarge`. :type number_of_nodes: integer :param number_of_nodes: The new number of nodes of the cluster. If you @@ -2269,7 +2331,7 @@ class RedshiftConnection(AWSQueryConnection): A list of cluster security groups to be authorized on this cluster. This change is asynchronously applied as soon as possible. - Security groups currently associated with the cluster and not in the + Security groups currently associated with the cluster, and not in the list of groups to apply, will be revoked from the cluster. Constraints: @@ -2280,7 +2342,7 @@ class RedshiftConnection(AWSQueryConnection): + Cannot end with a hyphen or contain two consecutive hyphens :type vpc_security_group_ids: list - :param vpc_security_group_ids: A list of Virtual Private Cloud (VPC) + :param vpc_security_group_ids: A list of virtual private cloud (VPC) security groups to be associated with the cluster. :type master_user_password: string @@ -2290,10 +2352,6 @@ class RedshiftConnection(AWSQueryConnection): request and the completion of the request, the `MasterUserPassword` element exists in the `PendingModifiedValues` element of the operation response. - Operations never return the password, so this operation provides a way - to regain access to the master user account for a cluster if the - password is lost. - Default: Uses existing setting. @@ -2323,7 +2381,7 @@ class RedshiftConnection(AWSQueryConnection): you can still create manual snapshots when you want with CreateClusterSnapshot. If you decrease the automated snapshot retention period from its - current value, existing automated snapshots which fall outside of + current value, existing automated snapshots that fall outside of the new retention period will be immediately deleted. Default: Uses existing setting. @@ -2376,6 +2434,20 @@ class RedshiftConnection(AWSQueryConnection): configuration that contains the information the Amazon Redshift cluster can use to retrieve and store keys in an HSM. + :type new_cluster_identifier: string + :param new_cluster_identifier: The new identifier for the cluster. + Constraints: + + + + Must contain from 1 to 63 alphanumeric characters or hyphens. + + Alphabetic characters must be lowercase. + + First character must be a letter. + + Cannot end with a hyphen or contain two consecutive hyphens. + + Must be unique for all clusters within an AWS account. + + + Example: `examplecluster` + """ params = {'ClusterIdentifier': cluster_identifier, } if cluster_type is not None: @@ -2409,6 +2481,8 @@ class RedshiftConnection(AWSQueryConnection): params['HsmClientCertificateIdentifier'] = hsm_client_certificate_identifier if hsm_configuration_identifier is not None: params['HsmConfigurationIdentifier'] = hsm_configuration_identifier + if new_cluster_identifier is not None: + params['NewClusterIdentifier'] = new_cluster_identifier return self._make_request( action='ModifyCluster', verb='POST', @@ -2434,6 +2508,9 @@ class RedshiftConnection(AWSQueryConnection): parameter name and parameter value; other name-value pairs of the parameter are optional. + For the workload management (WLM) configuration, you must supply all + the name-value pairs in the wlm_json_configuration parameter. + """ params = {'ParameterGroupName': parameter_group_name, } self.build_complex_list_params( @@ -2694,7 +2771,12 @@ class RedshiftConnection(AWSQueryConnection): owner_account=None, hsm_client_certificate_identifier=None, hsm_configuration_identifier=None, - elastic_ip=None): + elastic_ip=None, + cluster_parameter_group_name=None, + cluster_security_groups=None, + vpc_security_group_ids=None, + preferred_maintenance_window=None, + automated_snapshot_retention_period=None): """ Creates a new cluster from a snapshot. Amazon Redshift creates the resulting cluster with the same configuration as the @@ -2705,11 +2787,8 @@ class RedshiftConnection(AWSQueryConnection): different security group and different parameter group with the restored cluster. - If a snapshot is taken of a cluster in VPC, you can restore it - only in VPC. In this case, you must provide a cluster subnet - group where you want the cluster restored. If snapshot is - taken of a cluster outside VPC, then you can restore it only - outside VPC. + If you restore a cluster into a VPC, you must provide a + cluster subnet group where you want the cluster restored. For more information about working with snapshots, go to `Amazon Redshift Snapshots`_ in the Amazon Redshift Management @@ -2787,6 +2866,68 @@ class RedshiftConnection(AWSQueryConnection): :type elastic_ip: string :param elastic_ip: The elastic IP (EIP) address for the cluster. + :type cluster_parameter_group_name: string + :param cluster_parameter_group_name: + The name of the parameter group to be associated with this cluster. + + Default: The default Amazon Redshift cluster parameter group. For + information about the default parameter group, go to `Working with + Amazon Redshift Parameter Groups`_. + + Constraints: + + + + Must be 1 to 255 alphanumeric characters or hyphens. + + First character must be a letter. + + Cannot end with a hyphen or contain two consecutive hyphens. + + :type cluster_security_groups: list + :param cluster_security_groups: A list of security groups to be + associated with this cluster. + Default: The default cluster security group for Amazon Redshift. + + Cluster security groups only apply to clusters outside of VPCs. + + :type vpc_security_group_ids: list + :param vpc_security_group_ids: A list of Virtual Private Cloud (VPC) + security groups to be associated with the cluster. + Default: The default VPC security group is associated with the cluster. + + VPC security groups only apply to clusters in VPCs. + + :type preferred_maintenance_window: string + :param preferred_maintenance_window: The weekly time range (in UTC) + during which automated cluster maintenance can occur. + Format: `ddd:hh24:mi-ddd:hh24:mi` + + Default: The value selected for the cluster from which the snapshot was + taken. The following list shows the time blocks for each region + from which the default maintenance windows are assigned. + + + + **US-East (Northern Virginia) Region:** 03:00-11:00 UTC + + **US-West (Oregon) Region** 06:00-14:00 UTC + + **EU (Ireland) Region** 22:00-06:00 UTC + + **Asia Pacific (Singapore) Region** 14:00-22:00 UTC + + **Asia Pacific (Sydney) Region** 12:00-20:00 UTC + + **Asia Pacific (Tokyo) Region** 17:00-03:00 UTC + + + Valid Days: Mon | Tue | Wed | Thu | Fri | Sat | Sun + + Constraints: Minimum 30-minute window. + + :type automated_snapshot_retention_period: integer + :param automated_snapshot_retention_period: The number of days that + automated snapshots are retained. If the value is 0, automated + snapshots are disabled. Even if automated snapshots are disabled, + you can still create manual snapshots when you want with + CreateClusterSnapshot. + Default: The value selected for the cluster from which the snapshot was + taken. + + Constraints: Must be a value from 0 to 35. + """ params = { 'ClusterIdentifier': cluster_identifier, @@ -2814,6 +2955,20 @@ class RedshiftConnection(AWSQueryConnection): params['HsmConfigurationIdentifier'] = hsm_configuration_identifier if elastic_ip is not None: params['ElasticIp'] = elastic_ip + if cluster_parameter_group_name is not None: + params['ClusterParameterGroupName'] = cluster_parameter_group_name + if cluster_security_groups is not None: + self.build_list_params(params, + cluster_security_groups, + 'ClusterSecurityGroups.member') + if vpc_security_group_ids is not None: + self.build_list_params(params, + vpc_security_group_ids, + 'VpcSecurityGroupIds.member') + if preferred_maintenance_window is not None: + params['PreferredMaintenanceWindow'] = preferred_maintenance_window + if automated_snapshot_retention_period is not None: + params['AutomatedSnapshotRetentionPeriod'] = automated_snapshot_retention_period return self._make_request( action='RestoreFromClusterSnapshot', verb='POST', @@ -2829,7 +2984,7 @@ class RedshiftConnection(AWSQueryConnection): for a previously authorized IP range or Amazon EC2 security group. To add an ingress rule, see AuthorizeClusterSecurityGroupIngress. For information about - managing security groups, go to`Amazon Redshift Cluster + managing security groups, go to `Amazon Redshift Cluster Security Groups`_ in the Amazon Redshift Management Guide . :type cluster_security_group_name: string diff --git a/boto/ses/connection.py b/boto/ses/connection.py index ed69ad29..d9774125 100644 --- a/boto/ses/connection.py +++ b/boto/ses/connection.py @@ -48,13 +48,13 @@ class SESConnection(AWSAuthConnection): self.DefaultRegionEndpoint) self.region = region super(SESConnection, self).__init__(self.region.endpoint, - aws_access_key_id, aws_secret_access_key, - is_secure, port, proxy, proxy_port, - proxy_user, proxy_pass, debug, - https_connection_factory, path, - security_token=security_token, - validate_certs=validate_certs, - profile_name=profile_name) + aws_access_key_id, aws_secret_access_key, + is_secure, port, proxy, proxy_port, + proxy_user, proxy_pass, debug, + https_connection_factory, path, + security_token=security_token, + validate_certs=validate_certs, + profile_name=profile_name) def _required_auth_capability(self): return ['ses'] @@ -260,18 +260,18 @@ class SESConnection(AWSAuthConnection): raise ValueError("No text or html body found for mail") self._build_list_params(params, to_addresses, - 'Destination.ToAddresses.member') + 'Destination.ToAddresses.member') if cc_addresses: self._build_list_params(params, cc_addresses, - 'Destination.CcAddresses.member') + 'Destination.CcAddresses.member') if bcc_addresses: self._build_list_params(params, bcc_addresses, - 'Destination.BccAddresses.member') + 'Destination.BccAddresses.member') if reply_addresses: self._build_list_params(params, reply_addresses, - 'ReplyToAddresses.member') + 'ReplyToAddresses.member') return self._make_request('SendEmail', params) @@ -318,7 +318,7 @@ class SESConnection(AWSAuthConnection): if destinations: self._build_list_params(params, destinations, - 'Destinations.member') + 'Destinations.member') return self._make_request('SendRawEmail', params) @@ -475,7 +475,7 @@ class SESConnection(AWSAuthConnection): """ params = {} self._build_list_params(params, identities, - 'Identities.member') + 'Identities.member') return self._make_request('GetIdentityVerificationAttributes', params) def verify_domain_identity(self, domain): @@ -531,17 +531,17 @@ class SESConnection(AWSAuthConnection): :param identity: An email address or domain name. :type notification_type: string - :param notification_type: The type of feedback notifications that will + :param notification_type: The type of feedback notifications that will be published to the specified topic. Valid Values: Bounce | Complaint | Delivery :type sns_topic: string or None - :param sns_topic: The Amazon Resource Name (ARN) of the Amazon Simple - Notification Service (Amazon SNS) topic. + :param sns_topic: The Amazon Resource Name (ARN) of the Amazon Simple + Notification Service (Amazon SNS) topic. """ params = { - 'Identity': identity, - 'NotificationType': notification_type + 'Identity': identity, + 'NotificationType': notification_type } if sns_topic: params['SnsTopic'] = sns_topic @@ -560,7 +560,6 @@ class SESConnection(AWSAuthConnection): :param forwarding_enabled: Specifies whether or not to enable feedback forwarding. """ return self._make_request('SetIdentityFeedbackForwardingEnabled', { - 'Identity': identity, - 'ForwardingEnabled': 'true' if forwarding_enabled else 'false' + 'Identity': identity, + 'ForwardingEnabled': 'true' if forwarding_enabled else 'false' }) - diff --git a/boto/ses/exceptions.py b/boto/ses/exceptions.py index c3341ece..d5649f61 100644 --- a/boto/ses/exceptions.py +++ b/boto/ses/exceptions.py @@ -3,6 +3,7 @@ Various exceptions that are specific to the SES module. """ from boto.exception import BotoServerError + class SESError(BotoServerError): """ Sub-class all SES-related errors from here. Don't raise this error @@ -13,24 +14,26 @@ class SESError(BotoServerError): pass - class SESAddressNotVerifiedError(SESError): """ Raised when a "Reply-To" address has not been validated in SES yet. """ pass + class SESIdentityNotVerifiedError(SESError): """ Raised when an identity (domain or address) has not been verified in SES yet. """ pass + class SESDomainNotConfirmedError(SESError): """ """ pass + class SESAddressBlacklistedError(SESError): """ After you attempt to send mail to an address, and delivery repeatedly diff --git a/boto/support/exceptions.py b/boto/support/exceptions.py index f4e33d01..cbc19b3a 100644 --- a/boto/support/exceptions.py +++ b/boto/support/exceptions.py @@ -32,3 +32,27 @@ class CaseCreationLimitExceeded(JSONResponseError): class InternalServerError(JSONResponseError): pass + + +class AttachmentLimitExceeded(JSONResponseError): + pass + + +class DescribeAttachmentLimitExceeded(JSONResponseError): + pass + + +class AttachmentSetIdNotFound(JSONResponseError): + pass + + +class AttachmentSetExpired(JSONResponseError): + pass + + +class AttachmentIdNotFound(JSONResponseError): + pass + + +class AttachmentSetSizeLimitExceeded(JSONResponseError): + pass diff --git a/boto/support/layer1.py b/boto/support/layer1.py index b1c3ea01..33e83cc4 100644 --- a/boto/support/layer1.py +++ b/boto/support/layer1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved +# Copyright (c) 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the @@ -21,19 +21,19 @@ # import boto +from boto.compat import json from boto.connection import AWSQueryConnection from boto.regioninfo import RegionInfo from boto.exception import JSONResponseError from boto.support import exceptions -from boto.compat import json class SupportConnection(AWSQueryConnection): """ AWS Support The AWS Support API reference is intended for programmers who need - detailed information about the AWS Support actions and data types. - This service enables you to manage your AWS Support cases + detailed information about the AWS Support operations and data + types. This service enables you to manage your AWS Support cases programmatically. It uses HTTP methods that return results in JSON format. @@ -43,29 +43,31 @@ class SupportConnection(AWSQueryConnection): get the refresh status of checks. The following list describes the AWS Support case management - actions: + operations: + **Service names, issue categories, and available severity - levels. **The actions DescribeServices and DescribeSeverityLevels - enable you to obtain AWS service names, service codes, service + levels. **The DescribeServices and DescribeSeverityLevels + operations return AWS service names, service codes, service categories, and problem severity levels. You use these values when - you call the CreateCase action. + you call the CreateCase operation. + **Case creation, case details, and case resolution.** The - actions CreateCase, DescribeCases, and ResolveCase enable you to - create AWS Support cases, retrieve them, and resolve them. - + **Case communication.** The actions DescribeCommunications and - AddCommunicationToCase enable you to retrieve and add - communication to AWS Support cases. + CreateCase, DescribeCases, DescribeAttachment, and ResolveCase + operations create AWS Support cases, retrieve information about + cases, and resolve cases. + + **Case communication.** The DescribeCommunications, + AddCommunicationToCase, and AddAttachmentsToSet operations + retrieve and add communications and attachments to AWS Support + cases. - The following list describes the actions available from the AWS + The following list describes the operations available from the AWS Support service for Trusted Advisor: + DescribeTrustedAdvisorChecks returns the list of checks that run against your AWS resources. - + Using the CheckId for a specific check returned by + + Using the `CheckId` for a specific check returned by DescribeTrustedAdvisorChecks, you can call DescribeTrustedAdvisorCheckResult to obtain the results for the check you specified. @@ -80,9 +82,10 @@ class SupportConnection(AWSQueryConnection): For authentication of requests, AWS Support uses `Signature Version 4 Signing Process`_. - See the AWS Support `User Guide`_ for information about how to use - this service to create and manage your support cases, and how to - call Trusted Advisor for results of checks on your resources. + See `About the AWS Support API`_ in the AWS Support User Guide for + information about how to use this service to create and manage + your support cases, and how to call Trusted Advisor for results of + checks on your resources. """ APIVersion = "2013-04-15" DefaultRegionName = "us-east-1" @@ -92,9 +95,15 @@ class SupportConnection(AWSQueryConnection): ResponseError = JSONResponseError _faults = { - "CaseIdNotFound": exceptions.CaseIdNotFound, "CaseCreationLimitExceeded": exceptions.CaseCreationLimitExceeded, + "AttachmentLimitExceeded": exceptions.AttachmentLimitExceeded, + "CaseIdNotFound": exceptions.CaseIdNotFound, + "DescribeAttachmentLimitExceeded": exceptions.DescribeAttachmentLimitExceeded, + "AttachmentSetIdNotFound": exceptions.AttachmentSetIdNotFound, "InternalServerError": exceptions.InternalServerError, + "AttachmentSetExpired": exceptions.AttachmentSetExpired, + "AttachmentIdNotFound": exceptions.AttachmentIdNotFound, + "AttachmentSetSizeLimitExceeded": exceptions.AttachmentSetSizeLimitExceeded, } @@ -103,15 +112,53 @@ class SupportConnection(AWSQueryConnection): if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) - kwargs['host'] = region.endpoint + + if 'host' not in kwargs or kwargs['host'] is None: + kwargs['host'] = region.endpoint + super(SupportConnection, self).__init__(**kwargs) self.region = region def _required_auth_capability(self): return ['hmac-v4'] + def add_attachments_to_set(self, attachments, attachment_set_id=None): + """ + Adds one or more attachments to an attachment set. If an + `AttachmentSetId` is not specified, a new attachment set is + created, and the ID of the set is returned in the response. If + an `AttachmentSetId` is specified, the attachments are added + to the specified set, if it exists. + + An attachment set is a temporary container for attachments + that are to be added to a case or case communication. The set + is available for one hour after it is created; the + `ExpiryTime` returned in the response indicates when the set + expires. The maximum number of attachments in a set is 3, and + the maximum size of any attachment in the set is 5 MB. + + :type attachment_set_id: string + :param attachment_set_id: The ID of the attachment set. If an + `AttachmentSetId` is not specified, a new attachment set is + created, and the ID of the set is returned in the response. If an + `AttachmentSetId` is specified, the attachments are added to the + specified set, if it exists. + + :type attachments: list + :param attachments: One or more attachments to add to the set. The + limit is 3 attachments per set, and the size limit is 5 MB per + attachment. + + """ + params = {'attachments': attachments, } + if attachment_set_id is not None: + params['attachmentSetId'] = attachment_set_id + return self.make_request(action='AddAttachmentsToSet', + body=json.dumps(params)) + def add_communication_to_case(self, communication_body, case_id=None, - cc_email_addresses=None): + cc_email_addresses=None, + attachment_set_id=None): """ Adds additional customer communication to an AWS Support case. You use the `CaseId` value to identify the case to add @@ -138,18 +185,26 @@ class SupportConnection(AWSQueryConnection): :param cc_email_addresses: The email addresses in the CC line of an email to be added to the support case. + :type attachment_set_id: string + :param attachment_set_id: The ID of a set of one or more attachments + for the communication to add to the case. Create the set by calling + AddAttachmentsToSet + """ params = {'communicationBody': communication_body, } if case_id is not None: params['caseId'] = case_id if cc_email_addresses is not None: params['ccEmailAddresses'] = cc_email_addresses + if attachment_set_id is not None: + params['attachmentSetId'] = attachment_set_id return self.make_request(action='AddCommunicationToCase', body=json.dumps(params)) def create_case(self, subject, communication_body, service_code=None, severity_code=None, category_code=None, - cc_email_addresses=None, language=None, issue_type=None): + cc_email_addresses=None, language=None, issue_type=None, + attachment_set_id=None): """ Creates a new case in the AWS Support Center. This operation is modeled on the behavior of the AWS Support Center `Open a @@ -157,6 +212,9 @@ class SupportConnection(AWSQueryConnection): following information: + #. **IssueType.** The type of issue for the case. You can + specify either "customer-service" or "technical." If you do + not indicate a value, the default is "technical." #. **ServiceCode.** The code for an AWS service. You obtain the `ServiceCode` by calling DescribeServices. #. **CategoryCode.** The category for the service defined for @@ -171,6 +229,8 @@ class SupportConnection(AWSQueryConnection): Center `Open a new case`_ page. #. **CommunicationBody.** The **Description** field on the AWS Support Center `Open a new case`_ page. + #. **AttachmentSetId.** The ID of a set of attachments that + has been created by using AddAttachmentsToSet. #. **Language.** The human language in which AWS Support handles the case. English and Japanese are currently supported. @@ -181,20 +241,11 @@ class SupportConnection(AWSQueryConnection): Credentials in the HTTP POST method or in a method or function call from one of the programming languages supported by an `AWS SDK`_. - #. **IssueType.** The type of issue for the case. You can - specify either "customer-service" or "technical." If you do - not indicate a value, the default is "technical." - - - - The AWS Support API does not currently support the ability to - add attachments to cases. You can, however, call - AddCommunicationToCase to add information to an open case. A successful CreateCase request returns an AWS Support case - number. Case numbers are used by the DescribeCases action to - retrieve existing AWS Support cases. + number. Case numbers are used by the DescribeCases operation + to retrieve existing AWS Support cases. :type subject: string :param subject: The title of the AWS Support case. @@ -204,14 +255,8 @@ class SupportConnection(AWSQueryConnection): to DescribeServices. :type severity_code: string - :param severity_code: - The code for the severity level returned by the call to - DescribeSeverityLevels. - - - The availability of severity levels depends on each customer's support - subscription. In other words, your subscription may not necessarily - require the urgent level of response time. + :param severity_code: The code for the severity level returned by the + call to DescribeSeverityLevels. :type category_code: string :param category_code: The category of problem for the AWS Support case. @@ -235,6 +280,10 @@ class SupportConnection(AWSQueryConnection): either "customer-service" or "technical." If you do not indicate a value, the default is "technical." + :type attachment_set_id: string + :param attachment_set_id: The ID of a set of one or more attachments + for the case. Create the set by using AddAttachmentsToSet. + """ params = { 'subject': subject, @@ -252,19 +301,43 @@ class SupportConnection(AWSQueryConnection): params['language'] = language if issue_type is not None: params['issueType'] = issue_type + if attachment_set_id is not None: + params['attachmentSetId'] = attachment_set_id return self.make_request(action='CreateCase', body=json.dumps(params)) + def describe_attachment(self, attachment_id): + """ + Returns the attachment that has the specified ID. Attachment + IDs are generated by the case management system when you add + an attachment to a case or case communication. Attachment IDs + are returned in the AttachmentDetails objects that are + returned by the DescribeCommunications operation. + + :type attachment_id: string + :param attachment_id: The ID of the attachment to return. Attachment + IDs are returned by the DescribeCommunications operation. + + """ + params = {'attachmentId': attachment_id, } + return self.make_request(action='DescribeAttachment', + body=json.dumps(params)) + def describe_cases(self, case_id_list=None, display_id=None, after_time=None, before_time=None, include_resolved_cases=None, next_token=None, - max_results=None, language=None): + max_results=None, language=None, + include_communications=None): """ Returns a list of cases that you specify by passing one or more case IDs. In addition, you can filter the cases by date by setting values for the `AfterTime` and `BeforeTime` request parameters. + Case data is available for 12 months after creation. If a case + was created more than 12 months ago, a request for data might + cause an error. + The response returns the following in JSON format: @@ -283,15 +356,18 @@ class SupportConnection(AWSQueryConnection): :type after_time: string :param after_time: The start date for a filtered date search on support - case communications. + case communications. Case communications are available for 12 + months after creation. :type before_time: string :param before_time: The end date for a filtered date search on support - case communications. + case communications. Case communications are available for 12 + months after creation. :type include_resolved_cases: boolean :param include_resolved_cases: Specifies whether resolved support cases - should be included in the DescribeCases results. + should be included in the DescribeCases results. The default is + false . :type next_token: string :param next_token: A resumption point for pagination. @@ -306,6 +382,10 @@ class SupportConnection(AWSQueryConnection): Japanese ("ja"). Language parameters must be passed explicitly for operations that take them. + :type include_communications: boolean + :param include_communications: Specifies whether communications should + be included in the DescribeCases results. The default is true . + """ params = {} if case_id_list is not None: @@ -324,6 +404,8 @@ class SupportConnection(AWSQueryConnection): params['maxResults'] = max_results if language is not None: params['language'] = language + if include_communications is not None: + params['includeCommunications'] = include_communications return self.make_request(action='DescribeCases', body=json.dumps(params)) @@ -331,12 +413,16 @@ class SupportConnection(AWSQueryConnection): after_time=None, next_token=None, max_results=None): """ - Returns communications regarding the support case. You can use - the `AfterTime` and `BeforeTime` parameters to filter by date. - The `CaseId` parameter enables you to identify a specific case - by its `CaseId` value. + Returns communications (and attachments) for one or more + support cases. You can use the `AfterTime` and `BeforeTime` + parameters to filter by date. You can use the `CaseId` + parameter to restrict the results to a particular case. + + Case data is available for 12 months after creation. If a case + was created more than 12 months ago, a request for data might + cause an error. - The `MaxResults` and `NextToken` parameters enable you to + You can use the `MaxResults` and `NextToken` parameters to control the pagination of the result set. Set `MaxResults` to the number of cases you want displayed on each page, and use `NextToken` to specify the resumption of pagination. @@ -348,11 +434,13 @@ class SupportConnection(AWSQueryConnection): :type before_time: string :param before_time: The end date for a filtered date search on support - case communications. + case communications. Case communications are available for 12 + months after creation. :type after_time: string :param after_time: The start date for a filtered date search on support - case communications. + case communications. Case communications are available for 12 + months after creation. :type next_token: string :param next_token: A resumption point for pagination. diff --git a/tests/integration/elasticache/test_layer1.py b/tests/integration/elasticache/test_layer1.py index f6552c4d..42e3008b 100644 --- a/tests/integration/elasticache/test_layer1.py +++ b/tests/integration/elasticache/test_layer1.py @@ -34,9 +34,9 @@ class TestElastiCacheConnection(unittest.TestCase): timeout = time.time() + 600 while time.time() < timeout: response = self.elasticache.describe_cache_clusters(cluster_id) - status = response['DescribeCacheClustersResponse']\ - ['DescribeCacheClustersResult']\ - ['CacheClusters'][0]['CacheClusterStatus'] + status = (response['DescribeCacheClustersResponse'] + ['DescribeCacheClustersResult'] + ['CacheClusters'][0]['CacheClusterStatus']) if status == 'available': break time.sleep(5) diff --git a/tests/integration/ses/test_connection.py b/tests/integration/ses/test_connection.py index 83b99944..4e849e9f 100644 --- a/tests/integration/ses/test_connection.py +++ b/tests/integration/ses/test_connection.py @@ -18,7 +18,7 @@ class SESConnectionTest(unittest.TestCase): self.assertTrue('GetIdentityDkimAttributesResult' in response['GetIdentityDkimAttributesResponse']) self.assertTrue( - 'DkimAttributes' in response['GetIdentityDkimAttributesResponse']\ + 'DkimAttributes' in response['GetIdentityDkimAttributesResponse'] ['GetIdentityDkimAttributesResult']) def test_set_identity_dkim_enabled(self): diff --git a/tests/unit/auth/test_sigv4.py b/tests/unit/auth/test_sigv4.py index 674ec0a7..7b4afa5c 100644 --- a/tests/unit/auth/test_sigv4.py +++ b/tests/unit/auth/test_sigv4.py @@ -251,6 +251,17 @@ class TestSigV4Handler(unittest.TestCase): auth2 = pickle.loads(pickled) self.assertEqual(auth.host, auth2.host) + def test_bytes_header(self): + auth = HmacAuthV4Handler('glacier.us-east-1.amazonaws.com', + mock.Mock(), self.provider) + request = HTTPRequest( + 'GET', 'http', 'glacier.us-east-1.amazonaws.com', 80, + 'x/./././x .html', None, {}, + {'x-amz-glacier-version': '2012-06-01', 'x-amz-hash': b'f00'}, '') + canonical = auth.canonical_request(request) + + self.assertIn('f00', canonical) + class TestS3HmacAuthV4Handler(unittest.TestCase): def setUp(self): diff --git a/tests/unit/ses/test_identity.py b/tests/unit/ses/test_identity.py index 26f5388d..014d68ab 100644 --- a/tests/unit/ses/test_identity.py +++ b/tests/unit/ses/test_identity.py @@ -123,6 +123,7 @@ class TestSESSetIdentityNotificationTopic(AWSMockServiceTestCase): self.assertEqual(2, len(response)) self.assertEqual(0, len(result)) + class TestSESSetIdentityFeedbackForwardingEnabled(AWSMockServiceTestCase): connection_class = SESConnection |