Best Python code snippet using localstack_python
work_request.py
Source:work_request.py  
1# coding: utf-82# Copyright (c) 2016, 2022, Oracle and/or its affiliates.  All rights reserved.3# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.4from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel  # noqa: F4015from oci.decorators import init_model_state_from_kwargs6@init_model_state_from_kwargs7class WorkRequest(object):8    """9    A description of the work request status.10    """11    #: A constant which can be used with the operation_type property of a WorkRequest.12    #: This constant has a value of "CREATE_GATEWAY"13    OPERATION_TYPE_CREATE_GATEWAY = "CREATE_GATEWAY"14    #: A constant which can be used with the operation_type property of a WorkRequest.15    #: This constant has a value of "UPDATE_GATEWAY"16    OPERATION_TYPE_UPDATE_GATEWAY = "UPDATE_GATEWAY"17    #: A constant which can be used with the operation_type property of a WorkRequest.18    #: This constant has a value of "DELETE_GATEWAY"19    OPERATION_TYPE_DELETE_GATEWAY = "DELETE_GATEWAY"20    #: A constant which can be used with the operation_type property of a WorkRequest.21    #: This constant has a value of "CREATE_DEPLOYMENT"22    OPERATION_TYPE_CREATE_DEPLOYMENT = "CREATE_DEPLOYMENT"23    #: A constant which can be used with the operation_type property of a WorkRequest.24    #: This constant has a value of "UPDATE_DEPLOYMENT"25    OPERATION_TYPE_UPDATE_DEPLOYMENT = "UPDATE_DEPLOYMENT"26    #: A constant which can be used with the operation_type property of a WorkRequest.27    #: This constant has a value of "DELETE_DEPLOYMENT"28    OPERATION_TYPE_DELETE_DEPLOYMENT = "DELETE_DEPLOYMENT"29    #: A constant which can be used with the operation_type property of a WorkRequest.30    #: This constant has a value of "CREATE_CERTIFICATE"31    OPERATION_TYPE_CREATE_CERTIFICATE = "CREATE_CERTIFICATE"32    #: A constant which can be used with the operation_type property of a WorkRequest.33    #: This constant has a value of "UPDATE_CERTIFICATE"34    OPERATION_TYPE_UPDATE_CERTIFICATE = "UPDATE_CERTIFICATE"35    #: A constant which can be used with the operation_type property of a WorkRequest.36    #: This constant has a value of "DELETE_CERTIFICATE"37    OPERATION_TYPE_DELETE_CERTIFICATE = "DELETE_CERTIFICATE"38    #: A constant which can be used with the operation_type property of a WorkRequest.39    #: This constant has a value of "CREATE_API"40    OPERATION_TYPE_CREATE_API = "CREATE_API"41    #: A constant which can be used with the operation_type property of a WorkRequest.42    #: This constant has a value of "UPDATE_API"43    OPERATION_TYPE_UPDATE_API = "UPDATE_API"44    #: A constant which can be used with the operation_type property of a WorkRequest.45    #: This constant has a value of "DELETE_API"46    OPERATION_TYPE_DELETE_API = "DELETE_API"47    #: A constant which can be used with the operation_type property of a WorkRequest.48    #: This constant has a value of "VALIDATE_API"49    OPERATION_TYPE_VALIDATE_API = "VALIDATE_API"50    #: A constant which can be used with the operation_type property of a WorkRequest.51    #: This constant has a value of "CREATE_SDK"52    OPERATION_TYPE_CREATE_SDK = "CREATE_SDK"53    #: A constant which can be used with the operation_type property of a WorkRequest.54    #: This constant has a value of "DELETE_SDK"55    OPERATION_TYPE_DELETE_SDK = "DELETE_SDK"56    #: A constant which can be used with the operation_type property of a WorkRequest.57    #: This constant has a value of "CREATE_USAGE_PLAN"58    OPERATION_TYPE_CREATE_USAGE_PLAN = "CREATE_USAGE_PLAN"59    #: A constant which can be used with the operation_type property of a WorkRequest.60    #: This constant has a value of "UPDATE_USAGE_PLAN"61    OPERATION_TYPE_UPDATE_USAGE_PLAN = "UPDATE_USAGE_PLAN"62    #: A constant which can be used with the operation_type property of a WorkRequest.63    #: This constant has a value of "DELETE_USAGE_PLAN"64    OPERATION_TYPE_DELETE_USAGE_PLAN = "DELETE_USAGE_PLAN"65    #: A constant which can be used with the operation_type property of a WorkRequest.66    #: This constant has a value of "CREATE_SUBSCRIBER"67    OPERATION_TYPE_CREATE_SUBSCRIBER = "CREATE_SUBSCRIBER"68    #: A constant which can be used with the operation_type property of a WorkRequest.69    #: This constant has a value of "UPDATE_SUBSCRIBER"70    OPERATION_TYPE_UPDATE_SUBSCRIBER = "UPDATE_SUBSCRIBER"71    #: A constant which can be used with the operation_type property of a WorkRequest.72    #: This constant has a value of "DELETE_SUBSCRIBER"73    OPERATION_TYPE_DELETE_SUBSCRIBER = "DELETE_SUBSCRIBER"74    #: A constant which can be used with the status property of a WorkRequest.75    #: This constant has a value of "ACCEPTED"76    STATUS_ACCEPTED = "ACCEPTED"77    #: A constant which can be used with the status property of a WorkRequest.78    #: This constant has a value of "IN_PROGRESS"79    STATUS_IN_PROGRESS = "IN_PROGRESS"80    #: A constant which can be used with the status property of a WorkRequest.81    #: This constant has a value of "FAILED"82    STATUS_FAILED = "FAILED"83    #: A constant which can be used with the status property of a WorkRequest.84    #: This constant has a value of "SUCCEEDED"85    STATUS_SUCCEEDED = "SUCCEEDED"86    #: A constant which can be used with the status property of a WorkRequest.87    #: This constant has a value of "CANCELING"88    STATUS_CANCELING = "CANCELING"89    #: A constant which can be used with the status property of a WorkRequest.90    #: This constant has a value of "CANCELED"91    STATUS_CANCELED = "CANCELED"92    def __init__(self, **kwargs):93        """94        Initializes a new WorkRequest object with values from keyword arguments.95        The following keyword arguments are supported (corresponding to the getters/setters of this class):96        :param id:97            The value to assign to the id property of this WorkRequest.98        :type id: str99        :param operation_type:100            The value to assign to the operation_type property of this WorkRequest.101            Allowed values for this property are: "CREATE_GATEWAY", "UPDATE_GATEWAY", "DELETE_GATEWAY", "CREATE_DEPLOYMENT", "UPDATE_DEPLOYMENT", "DELETE_DEPLOYMENT", "CREATE_CERTIFICATE", "UPDATE_CERTIFICATE", "DELETE_CERTIFICATE", "CREATE_API", "UPDATE_API", "DELETE_API", "VALIDATE_API", "CREATE_SDK", "DELETE_SDK", "CREATE_USAGE_PLAN", "UPDATE_USAGE_PLAN", "DELETE_USAGE_PLAN", "CREATE_SUBSCRIBER", "UPDATE_SUBSCRIBER", "DELETE_SUBSCRIBER", 'UNKNOWN_ENUM_VALUE'.102            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.103        :type operation_type: str104        :param status:105            The value to assign to the status property of this WorkRequest.106            Allowed values for this property are: "ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", 'UNKNOWN_ENUM_VALUE'.107            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.108        :type status: str109        :param compartment_id:110            The value to assign to the compartment_id property of this WorkRequest.111        :type compartment_id: str112        :param resources:113            The value to assign to the resources property of this WorkRequest.114        :type resources: list[oci.apigateway.models.WorkRequestResource]115        :param percent_complete:116            The value to assign to the percent_complete property of this WorkRequest.117        :type percent_complete: float118        :param time_accepted:119            The value to assign to the time_accepted property of this WorkRequest.120        :type time_accepted: datetime121        :param time_started:122            The value to assign to the time_started property of this WorkRequest.123        :type time_started: datetime124        :param time_finished:125            The value to assign to the time_finished property of this WorkRequest.126        :type time_finished: datetime127        """128        self.swagger_types = {129            'id': 'str',130            'operation_type': 'str',131            'status': 'str',132            'compartment_id': 'str',133            'resources': 'list[WorkRequestResource]',134            'percent_complete': 'float',135            'time_accepted': 'datetime',136            'time_started': 'datetime',137            'time_finished': 'datetime'138        }139        self.attribute_map = {140            'id': 'id',141            'operation_type': 'operationType',142            'status': 'status',143            'compartment_id': 'compartmentId',144            'resources': 'resources',145            'percent_complete': 'percentComplete',146            'time_accepted': 'timeAccepted',147            'time_started': 'timeStarted',148            'time_finished': 'timeFinished'149        }150        self._id = None151        self._operation_type = None152        self._status = None153        self._compartment_id = None154        self._resources = None155        self._percent_complete = None156        self._time_accepted = None157        self._time_started = None158        self._time_finished = None159    @property160    def id(self):161        """162        **[Required]** Gets the id of this WorkRequest.163        The `OCID`__ of the resource.164        __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm165        :return: The id of this WorkRequest.166        :rtype: str167        """168        return self._id169    @id.setter170    def id(self, id):171        """172        Sets the id of this WorkRequest.173        The `OCID`__ of the resource.174        __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm175        :param id: The id of this WorkRequest.176        :type: str177        """178        self._id = id179    @property180    def operation_type(self):181        """182        **[Required]** Gets the operation_type of this WorkRequest.183        The type of the work request.184        Allowed values for this property are: "CREATE_GATEWAY", "UPDATE_GATEWAY", "DELETE_GATEWAY", "CREATE_DEPLOYMENT", "UPDATE_DEPLOYMENT", "DELETE_DEPLOYMENT", "CREATE_CERTIFICATE", "UPDATE_CERTIFICATE", "DELETE_CERTIFICATE", "CREATE_API", "UPDATE_API", "DELETE_API", "VALIDATE_API", "CREATE_SDK", "DELETE_SDK", "CREATE_USAGE_PLAN", "UPDATE_USAGE_PLAN", "DELETE_USAGE_PLAN", "CREATE_SUBSCRIBER", "UPDATE_SUBSCRIBER", "DELETE_SUBSCRIBER", 'UNKNOWN_ENUM_VALUE'.185        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.186        :return: The operation_type of this WorkRequest.187        :rtype: str188        """189        return self._operation_type190    @operation_type.setter191    def operation_type(self, operation_type):192        """193        Sets the operation_type of this WorkRequest.194        The type of the work request.195        :param operation_type: The operation_type of this WorkRequest.196        :type: str197        """198        allowed_values = ["CREATE_GATEWAY", "UPDATE_GATEWAY", "DELETE_GATEWAY", "CREATE_DEPLOYMENT", "UPDATE_DEPLOYMENT", "DELETE_DEPLOYMENT", "CREATE_CERTIFICATE", "UPDATE_CERTIFICATE", "DELETE_CERTIFICATE", "CREATE_API", "UPDATE_API", "DELETE_API", "VALIDATE_API", "CREATE_SDK", "DELETE_SDK", "CREATE_USAGE_PLAN", "UPDATE_USAGE_PLAN", "DELETE_USAGE_PLAN", "CREATE_SUBSCRIBER", "UPDATE_SUBSCRIBER", "DELETE_SUBSCRIBER"]199        if not value_allowed_none_or_none_sentinel(operation_type, allowed_values):200            operation_type = 'UNKNOWN_ENUM_VALUE'201        self._operation_type = operation_type202    @property203    def status(self):204        """205        **[Required]** Gets the status of this WorkRequest.206        The status of the work request.207        Allowed values for this property are: "ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", 'UNKNOWN_ENUM_VALUE'.208        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.209        :return: The status of this WorkRequest.210        :rtype: str211        """212        return self._status213    @status.setter214    def status(self, status):215        """216        Sets the status of this WorkRequest.217        The status of the work request.218        :param status: The status of this WorkRequest.219        :type: str220        """221        allowed_values = ["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]222        if not value_allowed_none_or_none_sentinel(status, allowed_values):223            status = 'UNKNOWN_ENUM_VALUE'224        self._status = status225    @property226    def compartment_id(self):227        """228        **[Required]** Gets the compartment_id of this WorkRequest.229        The `OCID`__ of the compartment in which the230        resource is created.231        __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm232        :return: The compartment_id of this WorkRequest.233        :rtype: str234        """235        return self._compartment_id236    @compartment_id.setter237    def compartment_id(self, compartment_id):238        """239        Sets the compartment_id of this WorkRequest.240        The `OCID`__ of the compartment in which the241        resource is created.242        __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm243        :param compartment_id: The compartment_id of this WorkRequest.244        :type: str245        """246        self._compartment_id = compartment_id247    @property248    def resources(self):249        """250        **[Required]** Gets the resources of this WorkRequest.251        The resources affected by this work request.252        :return: The resources of this WorkRequest.253        :rtype: list[oci.apigateway.models.WorkRequestResource]254        """255        return self._resources256    @resources.setter257    def resources(self, resources):258        """259        Sets the resources of this WorkRequest.260        The resources affected by this work request.261        :param resources: The resources of this WorkRequest.262        :type: list[oci.apigateway.models.WorkRequestResource]263        """264        self._resources = resources265    @property266    def percent_complete(self):267        """268        **[Required]** Gets the percent_complete of this WorkRequest.269        Percentage of the request completed.270        :return: The percent_complete of this WorkRequest.271        :rtype: float272        """273        return self._percent_complete274    @percent_complete.setter275    def percent_complete(self, percent_complete):276        """277        Sets the percent_complete of this WorkRequest.278        Percentage of the request completed.279        :param percent_complete: The percent_complete of this WorkRequest.280        :type: float281        """282        self._percent_complete = percent_complete283    @property284    def time_accepted(self):285        """286        **[Required]** Gets the time_accepted of this WorkRequest.287        The date and time the request was created, as described in288        `RFC 3339`__, section 14.29.289        __ https://tools.ietf.org/rfc/rfc3339290        :return: The time_accepted of this WorkRequest.291        :rtype: datetime292        """293        return self._time_accepted294    @time_accepted.setter295    def time_accepted(self, time_accepted):296        """297        Sets the time_accepted of this WorkRequest.298        The date and time the request was created, as described in299        `RFC 3339`__, section 14.29.300        __ https://tools.ietf.org/rfc/rfc3339301        :param time_accepted: The time_accepted of this WorkRequest.302        :type: datetime303        """304        self._time_accepted = time_accepted305    @property306    def time_started(self):307        """308        Gets the time_started of this WorkRequest.309        The date and time the request was started, as described in `RFC 3339`__,310        section 14.29.311        __ https://tools.ietf.org/rfc/rfc3339312        :return: The time_started of this WorkRequest.313        :rtype: datetime314        """315        return self._time_started316    @time_started.setter317    def time_started(self, time_started):318        """319        Sets the time_started of this WorkRequest.320        The date and time the request was started, as described in `RFC 3339`__,321        section 14.29.322        __ https://tools.ietf.org/rfc/rfc3339323        :param time_started: The time_started of this WorkRequest.324        :type: datetime325        """326        self._time_started = time_started327    @property328    def time_finished(self):329        """330        Gets the time_finished of this WorkRequest.331        The date and time the request was finished, as described in `RFC 3339`__.332        __ https://tools.ietf.org/rfc/rfc3339333        :return: The time_finished of this WorkRequest.334        :rtype: datetime335        """336        return self._time_finished337    @time_finished.setter338    def time_finished(self, time_finished):339        """340        Sets the time_finished of this WorkRequest.341        The date and time the request was finished, as described in `RFC 3339`__.342        __ https://tools.ietf.org/rfc/rfc3339343        :param time_finished: The time_finished of this WorkRequest.344        :type: datetime345        """346        self._time_finished = time_finished347    def __repr__(self):348        return formatted_flat_dict(self)349    def __eq__(self, other):350        if other is None:351            return False352        return self.__dict__ == other.__dict__353    def __ne__(self, other):...api_gateway.py
Source:api_gateway.py  
...67        cl.get_usage_plan, usagePlanId=usage_plan_id68    )69    return None if resp["ResponseMetadata"]["HTTPStatusCode"] != 200 else resp70@helpers.attempt_api_call_multiple_times71def delete_usage_plan(cl: boto3.client, usage_plan_id: str, dry: bool):72    """73    Delete a usage plan74    """75    if dry:76        return helpers.dry_run_success_resp()77    return helpers.make_call_catch_err(78        cl.delete_usage_plan, usagePlanId=usage_plan_id79    )80@helpers.attempt_api_call_multiple_times81def delete_stage(cl: boto3.client, rest_api_id: str, stage_name: str, dry: bool):82    """83    Delete a stage from some rest api84    """85    if dry:...apigateway.py
Source:apigateway.py  
...18    return list_apis19def delete_usage_plans(client):20    responses = []21    for plan in client.get_usage_plans()['items']:22        response = client.delete_usage_plan(usagePlanId=plan['id'])23        responses.append(response)24    return responses25def delete_api_keys(client):26    responses = []27    for key in list_api_keys(client):28        response = client.delete_api_key(apiKey=key)29        responses.append(response)30    return responses31api = boto3.client('apigateway')...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
