Permanently deletes the Endpoint token.
@param client the bandwidth client.
@param domainId the domain id.
@param endpointId the Endpoint id.
@param token
@throws AppPlatformException API Exception
@throws IOException unexpected error
335823
public static void delete(final BandwidthClient client, final String domainId, final String endpointId, final String token) throws AppPlatformException, ParseException, IOException {
        assert(client != null && domainId != null && endpointId != null && endpointId != null);
        deleteToken(client, domainId, endpointId, token);
    }
265653
public void synchronizeTokens(Endpoint tokenEndPoint) {

	    Integer subscriptionId = tokenEndPoint.getSubscriptionId();
	    String partnerAuthorizationToken = tokenEndPoint.getSubscription().getPartnerAuthorizationToken();
		String lastSyncDate = getLastSyncDate(subscriptionId);

		int totalCount = 1;
		int numberRetrieved = 0;
		Date startOfSync = new Date();

		while (totalCount > numberRetrieved) {
			String tokenUrl = tokenEndPoint.getUrl();
			tokenUrl += "?offset=" + numberRetrieved + "&limit=" + PAGE_SIZE;

			if (lastSyncDate != null) {
				tokenUrl += "&date_from=" + lastSyncDate;
			}
			LOG.info("Get tokens at endpoint: " + tokenUrl);

			TokenResponse tokenResponse = (TokenResponse) doRequest(new HttpGet(tokenUrl), partnerAuthorizationToken, TokenResponse.class);

			if (tokenResponse.totalCount == null) {
				break;
			}
			totalCount = tokenResponse.totalCount;

			numberRetrieved += tokenResponse.data.size();
			LOG.info("Inserting " + tokenResponse.data.size() + " tokens");

			for (io.motown.ocpi.dto.Token token : tokenResponse.data) {
				insertOrUpdateToken(token, subscriptionId);
			}
		}

		updateLastSynchronizationDate(startOfSync, subscriptionId);
		LOG.info("Number of tokens retrieved: " + numberRetrieved);
	}
438712
def server_delete(endpoint_id, server):
    
    client = get_client()

    mode = _detect_mode(server)

    # list (even if not necessary) in order to make errors more consistent when
    # mode='id'
    endpoint, server_list = get_endpoint_w_server_list(endpoint_id)

    if server_list == "S3":
        raise click.UsageError("You cannot delete servers from S3 endpoints.")

    # we don't *have to* raise an error in the GCP case, since the API would
    # deny it too, but doing so makes our errors a little bit more consistent
    # with deletes against S3 endpoints and shares
    if endpoint["is_globus_connect"]:
        raise click.UsageError(
            "You cannot delete servers from Globus Connect Personal endpoints"
        )

    if mode != "id":
        matches = _spec_to_matches(server_list, server, mode)
        if not matches:
            raise click.UsageError('No server was found matching "{}"'.format(server))
        elif len(matches) > 1:
            raise click.UsageError(
                dedent(
                    """\
                Multiple servers matched "{}":
                    {}
            """
                ).format(server, [x["id"] for x in matches])
            )
        else:
            server = matches[0]["id"]

    response = client.delete_endpoint_server(endpoint_id, server)

    formatted_print(response, text_format=FORMAT_TEXT_RAW, response_key="message")
1052383
@SuppressWarnings("WeakerAccess")
  public ApiFuture<Void> deleteAppProfileAsync(String instanceId, String appProfileId) {
    String name = NameUtil.formatAppProfileName(projectId, instanceId, appProfileId);
    DeleteAppProfileRequest request = DeleteAppProfileRequest.newBuilder().setName(name).build();

    return ApiFutures.transform(
        stub.deleteAppProfileCallable().futureCall(request),
        new ApiFunction<Empty, Void>() {
          @Override
          public Void apply(Empty input) {
            return null;
          }
        },
        MoreExecutors.directExecutor());
  }
481991
public void bindEip(BindEipRequest request) {
        checkStringNotEmpty(request.getEip(), "eip should not be empty");
        if (Strings.isNullOrEmpty(request.getClientToken())) {
            request.setClientToken(generateDefaultClientToken());
        }
        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT, request.getEip());
        internalRequest.addParameter("bind", null);
        internalRequest.addParameter(CLIENT_TOKEN_IDENTIFY, request.getClientToken());
        fillPayload(internalRequest, request);
        invokeHttpClient(internalRequest, AbstractBceResponse.class);
    }
179158
public void delete(int id) {
        String url = WxEndpoint.get("url.tag.delete");
        String json = JsonMapper.nonEmptyMapper().toJson(new TagWrapper(id));
        logger.debug("delete tag: {}", json);
        wxClient.post(url, json);
    }
455083
public PlatformResponse revokeToken(String token) throws ConnectionException {

        logger.debug("Enter OAuth2PlatformClient::revokeToken");
        
        PlatformResponse platformResponse = new PlatformResponse();
        try {
            
            HttpRequestClient client = new HttpRequestClient(oauth2Config.getProxyConfig());
            Request request = new Request.RequestBuilder(MethodType.POST, oauth2Config.getIntuitRevokeTokenEndpoint())
                                        .requiresAuthentication(true)
                                        .authString(getAuthHeader())
                                        .postParams(getUrlParameters("revoke", token, null))
                                        .build();

            Response response = client.makeRequest(request);
            
            logger.debug("Response Code : "+ response.getStatusCode());
            if (response.getStatusCode() != 200) {
                logger.debug("failed to revoke token");
                platformResponse.setStatus("ERROR");
                platformResponse.setErrorCode(response.getStatusCode() + "");
                platformResponse.setErrorMessage("Failed to revoke token");
                return platformResponse;
            }
            
            platformResponse.setStatus("SUCCESS");
            return platformResponse;
        }
        catch (Exception ex) {
            logger.error("Exception while calling revokeToken ", ex);
            throw new ConnectionException(ex.getMessage(), ex);
        }    
    }
864142
public void remove(Token token,
                       boolean requiresCurrentCheckpoint)
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "remove",
                        new Object[] { token, new Boolean(requiresCurrentCheckpoint) });

        super.remove(token, requiresCurrentCheckpoint);

        // Cancel any writing.
        managedObjectsToWrite.remove(new Long(token.storedObjectIdentifier));

        // Now Schedule the deletion of the disk copy.

        // TODO see TODO for tokens toWrite in add() above.
        if (storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN) {
            // We dont need to add Objects that are not in the directory as they wont need to be 
            // deleted. This is important for Stores only written at shutdown as they may 
            // accumulate a lot of delete operations.
            if (managedObjectsOnDisk.contains(new Long(token.storedObjectIdentifier)))
                tokensToDelete.put(new Long(token.storedObjectIdentifier),
                                   token);

        } else if (requiresCurrentCheckpoint) {
            // The checkpoint logic in ObjectManagerState never calls flush until all of the
            // requiresCurrentCheckpoint transactions have been checkpointed. So no need to synchronize 
            // on checkpointManagedObjectsToWrite.
            if (checkpointTokensToDelete == null)
                captureCheckpointManagedObjects();
            checkpointTokensToDelete.put(new Long(token.storedObjectIdentifier),
                                         token);

        } else {
            // If flush() gets ahead of our addition to this table it will be deleted
            // next time.
            // Repeat attempts to insert the token into the tokensToDelete util we find one that 
            // we can be sure was included in a flush().
            for (;;) {
                java.util.Map myTokensToDelete = tokensToDelete;
                myTokensToDelete.put(new Long(token.storedObjectIdentifier),
                                     token);
                // Make sure the flush() did not steal tokensToDelete while we were adding to it.
                if (myTokensToDelete == tokensToDelete)
                    break;
            } // for (;;).
        }

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       "remove");
    }
649833
public static boolean forgetIDTokensForServer(URL serverURL, TokenStore tokenStore) {
        OpenIDConnectAuthorizer authorizer = new OpenIDConnectAuthorizer(null, tokenStore);
        authorizer.setRemoteURL(serverURL);
        // Deliberately don't set auth.localUUID. This will leave kSecAttrAccount unset in the
        // dictionary passed to SecItemDelete, deleting keychain items for all accounts (databases).
        return authorizer.deleteTokens();
    }
722631
private DeleteInternetGatewayResponseType deleteInternetGateway(
            final String internetGatewayId) {
        DeleteInternetGatewayResponseType ret = new DeleteInternetGatewayResponseType();
        ret.setRequestId(UUID.randomUUID().toString());
        mockInternetGatewayController.deleteInternetGateway(internetGatewayId);
        return ret;
    }
902525
public static Domain create(final BandwidthClient client, final Map<String, Object>params) throws AppPlatformException, ParseException, Exception {
        assert (client!= null && params != null);
        final String domainsUri =  client.getUserResourceUri(BandwidthConstants.DOMAINS_URI_PATH);
        final RestResponse response = client.post(domainsUri, params);
        final JSONObject callObj = toJSONObject(client.get(response.getLocation(), null));
        return new Domain(client, callObj);
    }
645161
public static base_response delete(nitro_service client, String intranetapplication) throws Exception {
		vpnintranetapplication deleteresource = new vpnintranetapplication();
		deleteresource.intranetapplication = intranetapplication;
		return deleteresource.delete_resource(client);
	}
259032
public synchronized void initialiseFromAPIToken(final String token)
	{
		final String responseStr = authService.getToken(UserManagerOAuthService.GRANT_TYPE_TOKEN_EXCHANGE,
		                                                null,
		                                                getOwnCallbackUri().toString(),
		                                                clientId,
		                                                clientSecret,
		                                                null,
		                                                null,
		                                                null,
		                                                token);

		loadAuthResponse(responseStr);
	}
600839
@Override
  public void onConnect(URI serverHost) throws IOException {
    if (!StringUtils.isEmpty(accessToken)) {
      return; //No need to be called if accessToken is active.
    }

    try {
      getLog().info("Getting Oauth2 access token.");
      OAuthClientRequest request = OAuthClientRequest.tokenLocation(serverHost.toString())
          .setGrantType(GrantType.PASSWORD)
          .setClientId(clientId)
          .setClientSecret(clientSecret)
          .setUsername(userId)
          .setPassword(password + securityToken).buildQueryMessage();
      OAuthClient client = new OAuthClient(new URLConnectionClient());
      OAuthJSONAccessTokenResponse response = client.accessToken(request, OAuth.HttpMethod.POST);

      accessToken = response.getAccessToken();
      setCurServerHost(new URI(response.getParam("instance_url")));
    } catch (OAuthProblemException e) {
      throw new NonTransientException("Error while authenticating with Oauth2", e);
    } catch (OAuthSystemException e) {
      throw new RuntimeException("Failed getting access token", e);
    } catch (URISyntaxException e) {
      throw new RuntimeException("Failed due to invalid instance url", e);
    }
  }
395510
public void revokeToken() {

        URL url = null;
        try {
            url = new URL(this.revokeURL);
        } catch (MalformedURLException e) {
            assert false : "An invalid refresh URL indicates a bug in the SDK.";
            throw new RuntimeException("An invalid refresh URL indicates a bug in the SDK.", e);
        }

        String urlParameters = String.format("token=%s&client_id=%s&client_secret=%s",
                this.accessToken, this.clientID, this.clientSecret);

        BoxAPIRequest request = new BoxAPIRequest(this, url, "POST");
        request.shouldAuthenticate(false);
        request.setBody(urlParameters);

        try {
            request.send();
        } catch (BoxAPIException e) {
            throw e;
        }
    }
575110
public void remove(Token token,
                       boolean requiresCurrentCheckpoint)
                    throws ObjectManagerException {
        final String methodName = "remove";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        methodName,
                        new Object[] { token, new Boolean(requiresCurrentCheckpoint) });

        super.remove(token, requiresCurrentCheckpoint);

        // Cancel any writing.
        managedObjectsToWrite.remove(new Long(token.storedObjectIdentifier));

        // Schedule the deletion of the disk copy.
        if (storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN) {
            // We don't need to add Objects that are not in the directory as they wont need to be 
            // deleted. This is important for Stores only written at shutdown as they may 
            // accumulate a lot of delete operations.
            Directory.StoreArea storeArea = (Directory.StoreArea) directory.getEntry(new Long(token.storedObjectIdentifier));
            if (storeArea != null)
                tokensToDelete.put(new Long(token.storedObjectIdentifier),
                                   token);

        } else if (requiresCurrentCheckpoint) {
            // The checkpoint logic in ObjectManagerState never calls flush until all of the
            // requiresCurrentCheckpoint transactions have been checkpointed. So no need to synchronize 
            // on checkpointManagedObjectsToWrite.
            if (checkpointTokensToDelete == null)
                captureCheckpointManagedObjects();

            checkpointTokensToDelete.put(new Long(token.storedObjectIdentifier),
                                         token);

        } else {
            // If flush() gets ahead of our addition to this table it will be deleted
            // next time.
            // Repeat attempts to insert the token into the tokensToDelete until we find one that 
            // we can be sure was included in a flush().
            for (;;) {
                java.util.Map myTokensToDelete = tokensToDelete;
                myTokensToDelete.put(new Long(token.storedObjectIdentifier),
                                     token);
                // Make sure the flush() did not steal tokensToDelete while we were adding to it.
                if (myTokensToDelete == tokensToDelete)
                    break;
            } // for (;;).
        }

        // Cancel the ManagedObjects reference from the cache, if it is in memory. We might get the wrong
        // ManagedObject if the slot has been reused, that's OK because it's just the same as if it 
        // is being reused.
        if (token.managedObjectReference != null) {
            ManagedObject managedObject = (ManagedObject) token.managedObjectReference.get();
            if (managedObject != null) {
                java.lang.ref.SoftReference[] localCachedManagedObjects = cachedManagedObjects;
                if (managedObject.objectStoreCacheIndex < localCachedManagedObjects.length)
                    localCachedManagedObjects[managedObject.objectStoreCacheIndex] = null;
            }
        } // if (token.managedObjectReference != null).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       methodName);
    }
659534
@Override
  public void removeClient(long clientId) {
    LOG.info("Removing client " + clientId + " ...");
    synchronized (clientModificationsLock) {
      removedClients.add(clientId);
    }
  }