Best Python code snippet using localstack_python
test_health_check.py
Source:test_health_check.py  
1# Copyright (c) 2014 Tellybug, Matt Millar2#3# Permission is hereby granted, free of charge, to any person obtaining a4# copy of this software and associated documentation files (the5# "Software"), to deal in the Software without restriction, including6# without limitation the rights to use, copy, modify, merge, publish, dis-7# tribute, sublicense, and/or sell copies of the Software, and to permit8# persons to whom the Software is furnished to do so, subject to the fol-9# lowing conditions:10#11# The above copyright notice and this permission notice shall be included12# in all copies or substantial portions of the Software.13#14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS15# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-16# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT17# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,18# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20# IN THE SOFTWARE.21#22from tests.integration.route53 import Route53TestCase23from boto.compat import six24from boto.route53.healthcheck import HealthCheck25from boto.route53.record import ResourceRecordSets26class TestRoute53HealthCheck(Route53TestCase):27    def test_create_health_check(self):28        hc = HealthCheck(ip_addr="54.217.7.118", port=80, hc_type="HTTP", resource_path="/testing")29        result = self.conn.create_health_check(hc)30        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'Type'], 'HTTP')31        self.assertEquals(result[u'CreateHealthCheckResponse'][32                          u'HealthCheck'][u'HealthCheckConfig'][u'IPAddress'], '54.217.7.118')33        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'Port'], '80')34        self.assertEquals(result[u'CreateHealthCheckResponse'][35                          u'HealthCheck'][u'HealthCheckConfig'][u'ResourcePath'], '/testing')36        self.conn.delete_health_check(result['CreateHealthCheckResponse']['HealthCheck']['Id'])37    def test_create_https_health_check(self):38        hc = HealthCheck(ip_addr="54.217.7.118", port=443, hc_type="HTTPS", resource_path="/testing")39        result = self.conn.create_health_check(hc)40        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'Type'], 'HTTPS')41        self.assertEquals(result[u'CreateHealthCheckResponse'][42                          u'HealthCheck'][u'HealthCheckConfig'][u'IPAddress'], '54.217.7.118')43        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'Port'], '443')44        self.assertEquals(result[u'CreateHealthCheckResponse'][45                          u'HealthCheck'][u'HealthCheckConfig'][u'ResourcePath'], '/testing')46        self.assertFalse('FullyQualifiedDomainName' in result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'])47        self.conn.delete_health_check(result['CreateHealthCheckResponse']['HealthCheck']['Id'])48    def test_create_https_health_check_fqdn(self):49        hc = HealthCheck(ip_addr=None, port=443, hc_type="HTTPS", resource_path="/", fqdn="google.com")50        result = self.conn.create_health_check(hc)51        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'Type'], 'HTTPS')52        self.assertEquals(result[u'CreateHealthCheckResponse'][53                          u'HealthCheck'][u'HealthCheckConfig'][u'FullyQualifiedDomainName'], 'google.com')54        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'Port'], '443')55        self.assertEquals(result[u'CreateHealthCheckResponse'][56                          u'HealthCheck'][u'HealthCheckConfig'][u'ResourcePath'], '/')57        self.assertFalse('IPAddress' in result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'])58        self.conn.delete_health_check(result['CreateHealthCheckResponse']['HealthCheck']['Id'])59    def test_create_and_list_health_check(self):60        hc = HealthCheck(ip_addr="54.217.7.118", port=80, hc_type="HTTP", resource_path="/testing")61        result1 = self.conn.create_health_check(hc)62        hc = HealthCheck(ip_addr="54.217.7.119", port=80, hc_type="HTTP", resource_path="/testing")63        result2 = self.conn.create_health_check(hc)64        result = self.conn.get_list_health_checks()65        self.assertTrue(len(result['ListHealthChecksResponse']['HealthChecks']) > 1)66        self.conn.delete_health_check(result1['CreateHealthCheckResponse']['HealthCheck']['Id'])67        self.conn.delete_health_check(result2['CreateHealthCheckResponse']['HealthCheck']['Id'])68    def test_delete_health_check(self):69        hc = HealthCheck(ip_addr="54.217.7.118", port=80, hc_type="HTTP", resource_path="/testing")70        result = self.conn.create_health_check(hc)71        hc_id = result['CreateHealthCheckResponse']['HealthCheck']['Id']72        result = self.conn.get_list_health_checks()73        found = False74        for hc in result['ListHealthChecksResponse']['HealthChecks']:75            if hc['Id'] == hc_id:76                found = True77                break78        self.assertTrue(found)79        result = self.conn.delete_health_check(hc_id)80        result = self.conn.get_list_health_checks()81        for hc in result['ListHealthChecksResponse']['HealthChecks']:82            self.assertFalse(hc['Id'] == hc_id)83    def test_create_health_check_string_match(self):84        hc = HealthCheck(ip_addr="54.217.7.118", port=80, hc_type="HTTP_STR_MATCH", resource_path="/testing", string_match="test")85        result = self.conn.create_health_check(hc)86        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'Type'], 'HTTP_STR_MATCH')87        self.assertEquals(result[u'CreateHealthCheckResponse'][88                          u'HealthCheck'][u'HealthCheckConfig'][u'IPAddress'], '54.217.7.118')89        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'Port'], '80')90        self.assertEquals(result[u'CreateHealthCheckResponse'][91                          u'HealthCheck'][u'HealthCheckConfig'][u'ResourcePath'], '/testing')92        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'SearchString'], 'test')93        self.conn.delete_health_check(result['CreateHealthCheckResponse']['HealthCheck']['Id'])94    def test_create_health_check_https_string_match(self):95        hc = HealthCheck(ip_addr="54.217.7.118", port=80, hc_type="HTTPS_STR_MATCH", resource_path="/testing", string_match="test")96        result = self.conn.create_health_check(hc)97        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'Type'], 'HTTPS_STR_MATCH')98        self.assertEquals(result[u'CreateHealthCheckResponse'][99                          u'HealthCheck'][u'HealthCheckConfig'][u'IPAddress'], '54.217.7.118')100        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'Port'], '80')101        self.assertEquals(result[u'CreateHealthCheckResponse'][102                          u'HealthCheck'][u'HealthCheckConfig'][u'ResourcePath'], '/testing')103        self.assertEquals(result[u'CreateHealthCheckResponse'][u'HealthCheck'][u'HealthCheckConfig'][u'SearchString'], 'test')104        self.conn.delete_health_check(result['CreateHealthCheckResponse']['HealthCheck']['Id'])105    def test_create_resource_record_set(self):106        hc = HealthCheck(ip_addr="54.217.7.118", port=80, hc_type="HTTP", resource_path="/testing")107        result = self.conn.create_health_check(hc)108        records = ResourceRecordSets(109            connection=self.conn, hosted_zone_id=self.zone.id, comment='Create DNS entry for test')110        change = records.add_change('CREATE', 'unittest.%s.' % self.base_domain, 'A', ttl=30, identifier='test',111                                    weight=1, health_check=result['CreateHealthCheckResponse']['HealthCheck']['Id'])112        change.add_value("54.217.7.118")113        records.commit()114        records = ResourceRecordSets(self.conn, self.zone.id)115        deleted = records.add_change('DELETE', "unittest.%s." % self.base_domain, "A", ttl=30, identifier='test',116                                     weight=1, health_check=result['CreateHealthCheckResponse']['HealthCheck']['Id'])117        deleted.add_value('54.217.7.118')118        records.commit()119    def test_create_health_check_invalid_request_interval(self):120        """Test that health checks cannot be created with an invalid121        'request_interval'.122        """123        self.assertRaises(AttributeError, lambda: HealthCheck(**self.health_check_params(request_interval=5)))124    def test_create_health_check_invalid_failure_threshold(self):125        """126        Test that health checks cannot be created with an invalid127        'failure_threshold'.128        """129        self.assertRaises(AttributeError, lambda: HealthCheck(**self.health_check_params(failure_threshold=0)))130        self.assertRaises(AttributeError, lambda: HealthCheck(**self.health_check_params(failure_threshold=11)))131    def test_create_health_check_request_interval(self):132        hc_params = self.health_check_params(request_interval=10)133        hc = HealthCheck(**hc_params)134        result = self.conn.create_health_check(hc)135        hc_config = (result[u'CreateHealthCheckResponse']136                     [u'HealthCheck'][u'HealthCheckConfig'])137        self.assertEquals(hc_config[u'RequestInterval'],138                          six.text_type(hc_params['request_interval']))139        self.conn.delete_health_check(result['CreateHealthCheckResponse']['HealthCheck']['Id'])140    def test_create_health_check_failure_threshold(self):141        hc_params = self.health_check_params(failure_threshold=1)142        hc = HealthCheck(**hc_params)143        result = self.conn.create_health_check(hc)144        hc_config = (result[u'CreateHealthCheckResponse']145                     [u'HealthCheck'][u'HealthCheckConfig'])146        self.assertEquals(hc_config[u'FailureThreshold'],147                          six.text_type(hc_params['failure_threshold']))148        self.conn.delete_health_check(result['CreateHealthCheckResponse']['HealthCheck']['Id'])149    def health_check_params(self, **kwargs):150        params = {151            'ip_addr': "54.217.7.118",152            'port': 80,153            'hc_type': 'HTTP',154            'resource_path': '/testing',155        }156        params.update(kwargs)...http2.py
Source:http2.py  
1# -*- coding: utf-8 -*- #2# Copyright 2015 Google Inc. All Rights Reserved.3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8#    http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15"""Command for updating health checks."""16from __future__ import absolute_import17from __future__ import division18from __future__ import unicode_literals19from googlecloudsdk.api_lib.compute import base_classes20from googlecloudsdk.api_lib.compute import health_checks_utils21from googlecloudsdk.calliope import base22from googlecloudsdk.calliope import exceptions23from googlecloudsdk.command_lib.compute.health_checks import flags24from googlecloudsdk.core import exceptions as core_exceptions25from googlecloudsdk.core import log26@base.ReleaseTracks(base.ReleaseTrack.BETA)27class Update(base.UpdateCommand):28  """Update a HTTP2 health check.29  *{command}* is used to update an existing HTTP2 health check. Only30  arguments passed in will be updated on the health check. Other31  attributes will remain unaffected.32  """33  HEALTH_CHECK_ARG = None34  @classmethod35  def Args(cls, parser):36    cls.HEALTH_CHECK_ARG = flags.HealthCheckArgument('HTTP2')37    cls.HEALTH_CHECK_ARG.AddArgument(parser, operation_type='update')38    health_checks_utils.AddHttpRelatedUpdateArgs(parser, use_serving_port=True)39    health_checks_utils.AddHttpRelatedResponseArg(parser)40    health_checks_utils.AddProtocolAgnosticUpdateArgs(parser, 'HTTP2')41  def _GetGetRequest(self, client, health_check_ref):42    """Returns a request for fetching the existing health check."""43    return (client.apitools_client.healthChecks,44            'Get',45            client.messages.ComputeHealthChecksGetRequest(46                healthCheck=health_check_ref.Name(),47                project=health_check_ref.project))48  def _GetSetRequest(self, client, health_check_ref, replacement):49    """Returns a request for updating the health check."""50    return (client.apitools_client.healthChecks,51            'Update',52            client.messages.ComputeHealthChecksUpdateRequest(53                healthCheck=health_check_ref.Name(),54                healthCheckResource=replacement,55                project=health_check_ref.project))56  def _GetRegionalGetRequest(self, client, health_check_ref):57    """Returns a request for fetching the existing health check."""58    return (client.apitools_client.regionHealthChecks, 'Get',59            client.messages.ComputeRegionHealthChecksGetRequest(60                healthCheck=health_check_ref.Name(),61                project=health_check_ref.project,62                region=health_check_ref.region))63  def _GetRegionalSetRequest(self, client, health_check_ref, replacement):64    """Returns a request for updating the health check."""65    return (client.apitools_client.regionHealthChecks, 'Update',66            client.messages.ComputeRegionHealthChecksUpdateRequest(67                healthCheck=health_check_ref.Name(),68                healthCheckResource=replacement,69                project=health_check_ref.project,70                region=health_check_ref.region))71  def Modify(self, client, args, existing_check):72    """Returns a modified HealthCheck message."""73    # We do not support using 'update http2' with a health check of a74    # different protocol.75    if (existing_check.type !=76        client.messages.HealthCheck.TypeValueValuesEnum.HTTP2):77      raise core_exceptions.Error(78          'update http2 subcommand applied to health check with protocol ' +79          existing_check.type.name)80    # Description, PortName, Response and Host are the only attributes that can81    # be cleared by passing in an empty string (but we don't want to set it to82    # an empty string).83    if args.description:84      description = args.description85    elif args.description is None:86      description = existing_check.description87    else:88      description = None89    if args.host:90      host = args.host91    elif args.host is None:92      host = existing_check.http2HealthCheck.host93    else:94      host = None95    if args.response:96      response = args.response97    elif args.response is None:98      response = existing_check.http2HealthCheck.response99    else:100      response = None101    port, port_name, port_specification = health_checks_utils.\102        HandlePortRelatedFlagsForUpdate(103            args, existing_check.http2HealthCheck,104            supports_port_specification=True)105    proxy_header = existing_check.http2HealthCheck.proxyHeader106    if args.proxy_header is not None:107      proxy_header = (108          client.messages.HTTP2HealthCheck.ProxyHeaderValueValuesEnum(109              args.proxy_header))110    new_health_check = client.messages.HealthCheck(111        name=existing_check.name,112        description=description,113        type=client.messages.HealthCheck.TypeValueValuesEnum.HTTP2,114        http2HealthCheck=client.messages.HTTP2HealthCheck(115            host=host,116            port=port,117            portName=port_name,118            portSpecification=port_specification,119            requestPath=(args.request_path or120                         existing_check.http2HealthCheck.requestPath),121            proxyHeader=proxy_header,122            response=response),123        checkIntervalSec=(args.check_interval or124                          existing_check.checkIntervalSec),125        timeoutSec=args.timeout or existing_check.timeoutSec,126        healthyThreshold=(args.healthy_threshold or127                          existing_check.healthyThreshold),128        unhealthyThreshold=(args.unhealthy_threshold or129                            existing_check.unhealthyThreshold),130    )131    return new_health_check132  def Run(self, args):133    """Issues requests necessary to update the HTTP2 Health Checks."""134    holder = base_classes.ComputeApiHolder(self.ReleaseTrack())135    client = holder.client136    health_checks_utils.CheckProtocolAgnosticArgs(args)137    args_unset = not (args.port or args.request_path or args.check_interval or138                      args.timeout or args.healthy_threshold or139                      args.unhealthy_threshold or args.proxy_header or140                      args.use_serving_port)141    if (args.description is None and args.host is None and142        args.response is None and args.port_name is None and args_unset):143      raise exceptions.ToolException('At least one property must be modified.')144    health_check_ref = self.HEALTH_CHECK_ARG.ResolveAsResource(145        args, holder.resources)146    if health_checks_utils.IsRegionalHealthCheckRef(health_check_ref):147      get_request = self._GetRegionalGetRequest(client, health_check_ref)148    else:149      get_request = self._GetGetRequest(client, health_check_ref)150    objects = client.MakeRequests([get_request])151    new_object = self.Modify(client, args, objects[0])152    # If existing object is equal to the proposed object or if153    # Modify() returns None, then there is no work to be done, so we154    # print the resource and return.155    if objects[0] == new_object:156      log.status.Print(157          'No change requested; skipping update for [{0}].'.format(158              objects[0].name))159      return objects160    if health_checks_utils.IsRegionalHealthCheckRef(health_check_ref):161      set_request = self._GetRegionalSetRequest(client, health_check_ref,162                                                new_object)163    else:164      set_request = self._GetSetRequest(client, health_check_ref, new_object)165    return client.MakeRequests([set_request])166@base.ReleaseTracks(base.ReleaseTrack.ALPHA)167class UpdateAlpha(Update):168  """Update a HTTP2 health check.169  *{command}* is used to update an existing HTTP2 health check. Only170  arguments passed in will be updated on the health check. Other171  attributes will remain unaffected.172  """173  HEALTH_CHECK_ARG = None174  @classmethod175  def Args(cls, parser):176    cls.HEALTH_CHECK_ARG = flags.HealthCheckArgument(177        'HTTP2', include_alpha=True)178    cls.HEALTH_CHECK_ARG.AddArgument(parser, operation_type='update')179    health_checks_utils.AddHttpRelatedUpdateArgs(parser, use_serving_port=True)180    health_checks_utils.AddHttpRelatedResponseArg(parser)...udp.py
Source:udp.py  
1# -*- coding: utf-8 -*- #2# Copyright 2016 Google Inc. All Rights Reserved.3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8#    http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15"""Command for updating health checks."""16from __future__ import absolute_import17from __future__ import division18from __future__ import unicode_literals19from googlecloudsdk.api_lib.compute import base_classes20from googlecloudsdk.api_lib.compute import health_checks_utils21from googlecloudsdk.calliope import base22from googlecloudsdk.calliope import exceptions23from googlecloudsdk.command_lib.compute.health_checks import flags24from googlecloudsdk.core import exceptions as core_exceptions25from googlecloudsdk.core import log26@base.Hidden27@base.ReleaseTracks(base.ReleaseTrack.ALPHA)28class Update(base.UpdateCommand):29  """Update a UDP health check.30  *{command}* is used to update an existing UDP health check. Only31  arguments passed in will be updated on the health check. Other32  attributes will remain unaffected.33  """34  HEALTH_CHECK_ARG = None35  @classmethod36  def Args(cls, parser):37    cls.HEALTH_CHECK_ARG = flags.HealthCheckArgument('UDP', include_alpha=True)38    cls.HEALTH_CHECK_ARG.AddArgument(parser, operation_type='update')39    health_checks_utils.AddUdpRelatedArgs(parser,40                                          request_and_response_required=False)41    health_checks_utils.AddProtocolAgnosticUpdateArgs(parser, 'UDP')42  def _GetGetRequest(self, client, health_check_ref):43    """Returns a request for fetching the existing health check."""44    return (client.apitools_client.healthChecks,45            'Get',46            client.messages.ComputeHealthChecksGetRequest(47                healthCheck=health_check_ref.Name(),48                project=health_check_ref.project))49  def _GetSetRequest(self, client, health_check_ref, replacement):50    """Returns a request for updating the health check."""51    return (client.apitools_client.healthChecks,52            'Update',53            client.messages.ComputeHealthChecksUpdateRequest(54                healthCheck=health_check_ref.Name(),55                healthCheckResource=replacement,56                project=health_check_ref.project))57  def _GetRegionalGetRequest(self, client, health_check_ref):58    """Returns a request for fetching the existing health check."""59    return (client.apitools_client.regionHealthChecks, 'Get',60            client.messages.ComputeRegionHealthChecksGetRequest(61                healthCheck=health_check_ref.Name(),62                project=health_check_ref.project,63                region=health_check_ref.region))64  def _GetRegionalSetRequest(self, client, health_check_ref, replacement):65    """Returns a request for updating the health check."""66    return (client.apitools_client.regionHealthChecks, 'Update',67            client.messages.ComputeRegionHealthChecksUpdateRequest(68                healthCheck=health_check_ref.Name(),69                healthCheckResource=replacement,70                project=health_check_ref.project,71                region=health_check_ref.region))72  def Modify(self, client, args, existing_check):73    """Returns a modified HealthCheck message."""74    # We do not support using 'update udp' with a health check of a75    # different protocol.76    if (existing_check.type !=77        client.messages.HealthCheck.TypeValueValuesEnum.UDP):78      raise core_exceptions.Error(79          'update udp subcommand applied to health check with protocol ' +80          existing_check.type.name)81    # Description and PortName are the only attributes that can be cleared by82    # passing in an empty string (but we don't want to set it to empty string).83    if args.description:84      description = args.description85    elif args.description is None:86      description = existing_check.description87    else:88      description = None89    if args.port_name:90      port_name = args.port_name91    elif args.port_name is None:92      port_name = existing_check.udpHealthCheck.portName93    else:94      port_name = None95    new_health_check = client.messages.HealthCheck(96        name=existing_check.name,97        description=description,98        type=client.messages.HealthCheck.TypeValueValuesEnum.UDP,99        udpHealthCheck=client.messages.UDPHealthCheck(100            request=args.request or existing_check.udpHealthCheck.request,101            response=args.response or existing_check.udpHealthCheck.response,102            port=args.port or existing_check.udpHealthCheck.port,103            portName=port_name),104        checkIntervalSec=(args.check_interval or105                          existing_check.checkIntervalSec),106        timeoutSec=args.timeout or existing_check.timeoutSec,107        healthyThreshold=(args.healthy_threshold or108                          existing_check.healthyThreshold),109        unhealthyThreshold=(args.unhealthy_threshold or110                            existing_check.unhealthyThreshold),111    )112    return new_health_check113  def Run(self, args):114    """Issues requests necessary to update UDP Health Checks."""115    holder = base_classes.ComputeApiHolder(self.ReleaseTrack())116    client = holder.client117    health_checks_utils.CheckProtocolAgnosticArgs(args)118    args_unset = not (args.port119                      or args.check_interval120                      or args.timeout121                      or args.healthy_threshold122                      or args.unhealthy_threshold123                      or args.request124                      or args.response)125    if args.description is None and args.port_name is None and args_unset:126      raise exceptions.ToolException('At least one property must be modified.')127    # Check that request and response are not empty. It is acceptable for it to128    # be None.129    if args.request is not None and not args.request:130      raise exceptions.ToolException(131          '"request" field for UDP can not be empty.')132    if args.response is not None and not args.response:133      raise exceptions.ToolException(134          '"response" field for UDP can not be empty.')135    health_check_ref = self.HEALTH_CHECK_ARG.ResolveAsResource(136        args, holder.resources)137    if health_checks_utils.IsRegionalHealthCheckRef(health_check_ref):138      get_request = self._GetRegionalGetRequest(client, health_check_ref)139    else:140      get_request = self._GetGetRequest(client, health_check_ref)141    objects = client.MakeRequests([get_request])142    new_object = self.Modify(client, args, objects[0])143    # If existing object is equal to the proposed object or if144    # Modify() returns None, then there is no work to be done, so we145    # print the resource and return.146    if objects[0] == new_object:147      log.status.Print(148          'No change requested; skipping update for [{0}].'.format(149              objects[0].name))150      return objects151    if health_checks_utils.IsRegionalHealthCheckRef(health_check_ref):152      set_request = self._GetRegionalSetRequest(client, health_check_ref,153                                                new_object)154    else:155      set_request = self._GetSetRequest(client, health_check_ref, new_object)...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!!
