Calls the migrate API based on the the request provided and
returns an object with oauth2 tokens

@param environment
@return
@throws ConnectionException
541561
public OAuthMigrationResponse migrate() throws ConnectionException {

		logger.debug("Enter OAuthMigrationClient::migrate");
		
		try {
			
			
			HttpRequestClient client = new HttpRequestClient(oAuthMigrationRequest.getOauth2config().getProxyConfig());
			
			//prepare post json
			String requestjson =  new JSONObject().put("scope", getScopeValue(oAuthMigrationRequest.getScope()))
    				.put("redirect_uri", getRedirectUrl() )
    				.put("client_id", oAuthMigrationRequest.getOauth2config().getClientId())
    				.put("client_secret",oAuthMigrationRequest.getOauth2config().getClientSecret())
    				.toString();
			
			Request request = new Request.RequestBuilder(MethodType.GET, getMigrationAPIUrl(oAuthMigrationRequest.getEnvironment()))
											.requiresAuthentication(true)
											.postJson(requestjson)
											.build(); 
			//make the API call
			Response response = client.makeJsonRequest(request, oAuthMigrationRequest);

			logger.debug("Response Code : " + response.getStatusCode());
			if (response.getStatusCode() == 200) {
				ObjectReader reader = mapper.readerFor(OAuthMigrationResponse.class);
				OAuthMigrationResponse oAuthMigrationResponse = reader.readValue(response.getContent());
				return oAuthMigrationResponse;

			} else {
				logger.debug("failed calling migrate API");
				throw new ConnectionException("failed calling migrate API", response.getStatusCode() + "");
			}
		} catch (Exception ex) {
			logger.error("Exception while calling migrate", ex);
			throw new ConnectionException(ex.getMessage(), ex);
		}
	}
313085
public void credentialsMigration(T overrider, Class overriderClass) {
        try {
            deployerMigration(overrider, overriderClass);
            resolverMigration(overrider, overriderClass);
        } catch (NoSuchFieldException | IllegalAccessException | IOException e) {
            converterErrors.add(getConversionErrorMessage(overrider, e));
        }
    }
281051
@Override
    public AuthenticationRequest setConnection(String connection) {
        if (!hasLegacyPath()) {
            Log.w(TAG, "Not setting the 'connection' parameter as the request is using a OAuth 2.0 API Authorization endpoint that doesn't support it.");
            return this;
        }
        addParameter(CONNECTION_KEY, connection);
        return this;
    }
546018
@Override
  public Optional<HttpTracing> build(final Environment environment) {
    if (!isEnabled()) {
      LOGGER.warn("Zipkin tracing is disabled");
      return Optional.empty();
    }

    final ReporterMetrics metricsHandler = new DropwizardReporterMetrics(environment.metrics());

    final KafkaSender sender =
        KafkaSender.newBuilder()
            .bootstrapServers(bootstrapServers)
            .topic(topic)
            .overrides(overrides)
            .build();

    final AsyncReporter<Span> reporter =
        AsyncReporter.builder(sender).metrics(metricsHandler).build();

    environment.lifecycle().manage(new ReporterManager(reporter, sender));

    LOGGER.info("Sending spans to Kafka topic \"{}\" at: {}", topic, bootstrapServers);

    return buildTracing(environment, reporter);
  }
679
def execute(self, conn, daoinput, transaction = False):
        
        if not conn:
	    dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/MigrationRequests/Remove. Expects db connection from upper layer.",
                                self.logger.exception)
        daoinput['create_by'] = dbsUtils().getCreateBy()
	try:
            msg = "DBSMigration: Invalid request. Sucessfully processed or processing requests cannot be removed,\
                    or the requested migration did not exist, or the requestor for removing and creating has to be the same user. "
            checkit = self.dbi.processData(self.select, daoinput, conn, transaction)
            if self.formatDict(checkit)[0]["count"] >= 1:
		reqID = {'migration_rqst_id':daoinput['migration_rqst_id']}
	        result = self.dbi.processData(self.sql, reqID, conn, transaction)
            else:
                dbsExceptionHandler('dbsException-invalid-input', msg, self.logger.exception)
	except:
            raise
452942
public T asObject(EnvJAXB env) throws APIException {
		if(dataAsObject !=null) {
			return dataAsObject;
		} else {
			// Some Java compilers need two statements here
			dataAsObject = objectifier.objectify(env, dataAsString);
			return dataAsObject;
		}
	}
500280
public static function create(
        BunqEnumApiEnvironmentType $environmentType,
        string $apiKey,
        string $description,
        array $allPermittedIp = [],
        string $proxyUrl = null
    ): ApiContext {
        InstallationUtil::assertDeviceDescriptionIsValid($description);
        InstallationUtil::assertAllIpIsValid($allPermittedIp);

        $apiContext = new static();
        $apiContext->environmentType = $environmentType;
        $apiContext->apiKey = $apiKey;
        $apiContext->proxyUrl = $proxyUrl;
        $apiContext->initialize($description, $allPermittedIp);

        return $apiContext;
    }
574877
public OvhIpMigrationToken ip_migrationToken_POST(String ip, String customerId) throws IOException {
		String qPath = "/ip/{ip}/migrationToken";
		StringBuilder sb = path(qPath, ip);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "customerId", customerId);
		String resp = exec(qPath, "POST", sb.toString(), o);
		return convertTo(resp, OvhIpMigrationToken.class);
	}
1062759
public static JavacProcessingEnvironment instance(Context context) {
        JavacProcessingEnvironment instance = context.get(JavacProcessingEnvironment.class);
        if (instance == null)
            instance = new JavacProcessingEnvironment(context);
        return instance;
    }
429543
def create_api_environment(self):
        """"""
        return ApiEnvironment(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
812323
public static List<String> getCompositeTypeList(Environment environment) {
		return Binder.get(environment)
				.bind("spring.cloud.config.server", CompositeConfig.class).get()
				.getComposite().stream().map(map -> (String) map.get("type"))
				.collect(Collectors.toList());
	}
130952
public String migrate(String host, int port, Object key, int destinationDb, int timeout) {
		Jedis jedis = getJedis();
		try {
			return jedis.migrate(valueToBytes(host), port, keyToBytes(key), destinationDb, timeout);
		}
		finally {close(jedis);}
	}
1089780
public ServiceCall<Environment> getEnvironment(GetEnvironmentOptions getEnvironmentOptions) {
    Validator.notNull(getEnvironmentOptions, "getEnvironmentOptions cannot be null");
    String[] pathSegments = { "v1/environments" };
    String[] pathParameters = { getEnvironmentOptions.environmentId() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
        pathParameters));
    builder.query("version", versionDate);
    Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getEnvironment");
    for (Entry<String, String> header : sdkHeaders.entrySet()) {
      builder.header(header.getKey(), header.getValue());
    }
    builder.header("Accept", "application/json");
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Environment.class));
  }
29412
public Object openConnection(String endpointUri) throws ConnectionException {
        try {
            Map<String,String> params = getRequestParameters();
            if (params != null && !params.isEmpty()) {
                StringBuffer query = new StringBuffer();
                query.append(endpointUri.indexOf('?') < 0 ? '?' : '&');
                int count = 0;
                for (String name : params.keySet()) {
                    if (count > 0)
                        query.append('&');
                    String encoding = getUrlEncoding();
                    query.append(encoding == null ? name : URLEncoder.encode(name, encoding)).append("=");
                    query.append(encoding == null ? params.get(name) : URLEncoder.encode(params.get(name), encoding));
                    count++;
                }
                endpointUri += query;
            }
            URL url = new URL(endpointUri);

            HttpConnection httpConnection;
            if ("PATCH".equals(getHttpMethod()))
                httpConnection = new HttpAltConnection(url);
            else
                httpConnection = new HttpConnection(url);

            httpConnection.open();
            return httpConnection;
        }
        catch (Exception ex) {
            throw new ConnectionException(ConnectionException.CONNECTION_DOWN, ex.getMessage(), ex);
        }
    }
712885
def _call_migrate(self, module, connection_param):
        
        args = [connection_param]
        spec = inspect.getargspec(module.migrate)
        if len(spec.args) == 2:
            args.append(self.db_config)
        return module.migrate(*args)
209875
public static BerkeleyDB from(String envHomePath, String databaseName) {
        return env(envHomePath).connection(databaseName, null, null);
    }
1258827
public Response makeJsonRequest(Request request, OAuthMigrationRequest migrationRequest) throws InvalidRequestException {

		logger.debug("Enter HttpRequestClient::makeJsonRequest");
		//create oauth consumer using tokens
		OAuthConsumer consumer = new CommonsHttpOAuthConsumer(migrationRequest.getConsumerKey(), migrationRequest.getConsumerSecret());
		consumer.setTokenWithSecret(migrationRequest.getAccessToken(), migrationRequest.getAccessSecret());

		HttpPost post = new HttpPost(request.constructURL().toString());

		//sign
		try {
			consumer.sign(post);
		} catch (OAuthMessageSignerException e) {
			logger.error("Exception while making httpRequest", e);
			throw new InvalidRequestException(e.getMessage());
		} catch (OAuthExpectationFailedException e) {
			logger.error("Exception while making httpRequest", e);
			throw new InvalidRequestException(e.getMessage());
		} catch (OAuthCommunicationException e) {
			logger.error("Exception while making httpRequest", e);
			throw new InvalidRequestException(e.getMessage());
		}

		//add headers
		post.setHeader("Accept", "application/json");
		post.setHeader("Content-Type", "application/json");

		// add post data
		HttpEntity entity = new StringEntity(request.getPostJson(), "UTF-8");
		post.setEntity(entity);

		CloseableHttpResponse httpResponse = null;
		try {
			//make the call
			httpResponse = client.execute(post);
			//prepare response
			return new Response(httpResponse.getEntity() == null ? null : httpResponse.getEntity().getContent(), httpResponse.getStatusLine().getStatusCode());


		} catch (ClientProtocolException e) {
			logger.error("Exception while making httpRequest", e);
			throw new InvalidRequestException(e.getMessage());
		} catch (IOException e) {
			logger.error("Exception while making httpRequest", e);
			throw new InvalidRequestException(e.getMessage());
		}

	}