def delete_frontdoor_resource_property_entry(resource, prop):
    """ Factory method for creating delete functions. """

    def delete_func(cmd, resource_group_name, resource_name, item_name, no_wait=False):  # pylint: disable=unused-argument

        client = cf_frontdoor(cmd.cli_ctx, None)
        item = client.get(resource_group_name, resource_name)
        keep_items = \
            [x for x in item.__getattribute__(prop) if x.name.lower() != item_name.lower()]
        with UpdateContext(item) as c:
            c.update_param(prop, keep_items, False)
        if no_wait:
            sdk_no_wait(no_wait, client.create_or_update, resource_group_name, resource_name, item)
        else:
            result = sdk_no_wait(no_wait, client.create_or_update, resource_group_name, resource_name, item).result()
            if next((x for x in getattr(result, prop) if x.name.lower() == item_name.lower()), None):
                from knack.util import CLIError
                raise CLIError("Failed to delete '{}' on '{}'".format(item_name, resource_name))

    func_name = 'delete_fd_{}_{}'.format(resource, prop)
    setattr(sys.modules[__name__], func_name, delete_func)
    return func_name
def delete_frontdoor_resource_property_entry ( resource , prop ) : def delete_func ( cmd , resource_group_name , resource_name , item_name , no_wait = False ) : client = cf_frontdoor ( cmd . cli_ctx , None ) item = client . get ( resource_group_name , resource_name ) keep_items = [ x for x in item . __getattribute__ ( prop ) if x . name . lower ( ) != item_name . lower ( ) ] with UpdateContext ( item ) as c : c . update_param ( prop , keep_items , False ) if no_wait : sdk_no_wait ( no_wait , client . create_or_update , resource_group_name , resource_name , item ) else : result = sdk_no_wait ( no_wait , client . create_or_update , resource_group_name , resource_name , item ) . result ( ) if next ( ( x for x in getattr ( result , prop ) if x . name . lower ( ) == item_name . lower ( ) ) , None ) : from knack . util import CLIError raise CLIError ( "Failed to delete '{}' on '{}'" . format ( item_name , resource_name ) ) func_name = 'delete_fd_{}_{}' . format ( resource , prop ) setattr ( sys . modules [ __name__ ] , func_name , delete_func ) return func_name
Factory method for creating delete functions.