(self, federation_ident, patch)
return patch
Intercept PATCH JSON documents for unjoin operations.

        Take a PATCH JSON document with `remove` operation::
            {
                'op': 'remove',
                'value': 'former_member_id',
                'path': '/member_ids'
            }
        and transform it into a document with `replace` operation::
            {
                'op': 'replace',
                'value': ['current_member_id1', ..., 'current_member_idn'],
                'path': '/member_ids'
            }
Intercept PATCH JSON documents for unjoin operations.
Intercept PATCH JSON documents for unjoin operations .
def _unjoin_wrapper(self, federation_ident, patch):
        """Intercept PATCH JSON documents for unjoin operations.

        Take a PATCH JSON document with `remove` operation::
            {
                'op': 'remove',
                'value': 'former_member_id',
                'path': '/member_ids'
            }
        and transform it into a document with `replace` operation::
            {
                'op': 'replace',
                'value': ['current_member_id1', ..., 'current_member_idn'],
                'path': '/member_ids'
            }
        """
        federation = api_utils.get_resource('Federation', federation_ident)
        cluster_uuid = patch[0]['value']

        # Check if the cluster exists
        c = objects.Cluster.get_by_uuid(pecan.request.context, cluster_uuid)

        # Check if the cluster is a member cluster and if it exists
        if cluster_uuid in federation.member_ids and c is not None:
            # Retrieve all current members
            members = federation.member_ids
            # Unjoin the member
            members.remove(cluster_uuid)
        else:
            raise exception.HTTPNotFound("Cluster %s is not a member of the "
                                         "federation %s." % (cluster_uuid,
                                                             federation.name))

        # Set `value` to the updated member list. Change `op` to `replace`
        patch[0]['value'] = members
        patch[0]['op'] = 'replace'

        return patch
def _unjoin_wrapper ( self , federation_ident , patch ) : federation = api_utils . get_resource ( 'Federation' , federation_ident ) cluster_uuid = patch [ 0 ] [ 'value' ] # Check if the cluster exists c = objects . Cluster . get_by_uuid ( pecan . request . context , cluster_uuid ) # Check if the cluster is a member cluster and if it exists if cluster_uuid in federation . member_ids and c is not None : # Retrieve all current members members = federation . member_ids # Unjoin the member members . remove ( cluster_uuid ) else : raise exception . HTTPNotFound ( "Cluster %s is not a member of the " "federation %s." % ( cluster_uuid , federation . name ) ) # Set `value` to the updated member list. Change `op` to `replace` patch [ 0 ] [ 'value' ] = members patch [ 0 ] [ 'op' ] = 'replace' return patch