Get your projects.

@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object
355724
public ServiceFuture<List<Project>> getProjectsAsync(final ServiceCallback<List<Project>> serviceCallback) {
        return ServiceFuture.fromResponse(getProjectsWithServiceResponseAsync(), serviceCallback);
    }
1039455
protected Project getSelectedProject(UIContext context)
   {
      Project selectedProject = Projects.getSelectedProject(getProjectFactory(), context);
      if (isProjectRequired() && selectedProject == null)
      {
         throw new IllegalStateException("A project is required in the current context");
      }
      return selectedProject;
   }
189320
@Override
  public AnnotatedType api()
  {
    ServiceRefAmp delegate = delegate();
    
    if (delegate == null) {
      System.out.println("FAILED_DELEGATE: " + this);
    }
    
    return delegate().api();
  }
370709
public ServiceFuture<List<OperationValueInner>> listAsync(final ServiceCallback<List<OperationValueInner>> serviceCallback) {
        return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback);
    }
999248
public T waitForResult ()
        throws ServiceException
    {
        try {
            if (waitForResponse()) {
                return getArgument();
            } else {
                throw getError();
            }

        } catch (InvocationException ie) {
            // pass these through without a fuss
            throw new ServiceException(ie.getMessage());

        } catch (Exception e) {
            log.warning(_ident + " failed.", e);
            throw new ServiceException(InvocationCodes.E_INTERNAL_ERROR);
        }
    }
165188
public ServiceFuture<List<String>> listDomainsAsync(final ServiceCallback<List<String>> serviceCallback) {
        return ServiceFuture.fromResponse(listDomainsWithServiceResponseAsync(), serviceCallback);
    }
262981
public ServiceFuture<List<Domain>> getDomainsAsync(final ServiceCallback<List<Domain>> serviceCallback) {
        return ServiceFuture.fromResponse(getDomainsWithServiceResponseAsync(), serviceCallback);
    }
313649
public ServiceFuture<List<ExpressRouteGatewayInner>> listAsync(final ServiceCallback<List<ExpressRouteGatewayInner>> serviceCallback) {
        return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback);
    }
675426
public Observable<ServiceResponse<List<TermList>>> getAllTermListsWithServiceResponseAsync() {
        if (this.client.baseUrl() == null) {
            throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
        }
        String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl());
        return service.getAllTermLists(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<TermList>>>>() {
                @Override
                public Observable<ServiceResponse<List<TermList>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<List<TermList>> clientResponse = getAllTermListsDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }
1109464
public Observable<ServiceResponse<List<Project>>> getProjectsWithServiceResponseAsync() {
        if (this.client.apiKey() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
        }
        return service.getProjects(this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<Project>>>>() {
                @Override
                public Observable<ServiceResponse<List<Project>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<List<Project>> clientResponse = getProjectsDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }
1004911
public static <T> ServiceFuture<T> fromResponse(final Observable<ServiceResponse<T>> observable, final ServiceCallback<T> callback) {
        final ServiceFuture<T> serviceFuture = new ServiceFuture<>();
        serviceFuture.subscription = observable
                .last()
                .subscribe(new Action1<ServiceResponse<T>>() {
                    @Override
                    public void call(ServiceResponse<T> t) {
                        if (callback != null) {
                            callback.success(t.body());
                        }
                        serviceFuture.set(t.body());
                    }
                }, new Action1<Throwable>() {
                    @Override
                    public void call(Throwable throwable) {
                        if (callback != null) {
                            callback.failure(throwable);
                        }
                        serviceFuture.setException(throwable);
                    }
                });
        return serviceFuture;
    }
582328
@Override
    public Set<Scope> getProjects() {

        try {
            String url = featureSettings.getJiraBaseUrl() + (featureSettings.getJiraBaseUrl().endsWith("/") ? "" : "/")
                    + PROJECT_REST_SUFFIX;
            ResponseEntity<String> responseEntity = makeRestCall(url);
            String responseBody = responseEntity.getBody();

            JSONArray projects = (JSONArray) parser.parse(responseBody);

            return parseAsScopes(projects);

        } catch (ParseException pe) {
            LOGGER.error("Parser exception when parsing teams", pe);
        } catch (HygieiaException e) {
            LOGGER.error("Error in calling JIRA API", e);
        }
        return Collections.EMPTY_SET;
    }
941458
<R> R executeOnEndPoint(ServiceEndPoint endPoint, ServiceCallback<S, R> callback)
            throws Exception {
        ServiceHandle<S> handle = null;

        try {
            handle = _serviceCache.checkOut(endPoint);

            Timer.Context timer = _callbackExecutionTime.time();
            try {
                return callback.call(handle.getService());
            } finally {
                timer.stop();
            }
        } catch (NoCachedInstancesAvailableException e) {
            LOG.info("Service cache exhausted. End point: {}", endPoint, e);
            // Don't mark an end point as bad just because there are no cached end points for it.
            throw e;
        } catch (Exception e) {
            if (_serviceFactory.isRetriableException(e)) {
                // This is a known and supported exception indicating that something went wrong somewhere in the service
                // layer while trying to communicate with the end point.  These errors are often transient, so we
                // enqueue a health check for the end point and mark it as unavailable for the time being.
                markEndPointAsBad(endPoint);
                LOG.info("Bad end point discovered. End point: {}", endPoint, e);
            }
            throw e;
        } finally {
            if (handle != null) {
                try {
                    _serviceCache.checkIn(handle);
                } catch (Exception e) {
                    // This should never happen, but log just in case.
                    LOG.warn("Error returning end point to cache. End point: {}, {}",
                            endPoint, e.toString());
                    LOG.debug("Exception", e);
                }
            }
        }
    }
884268
public ServiceFuture<List<CognitiveServicesAccountInner>> listAsync(final ServiceCallback<List<CognitiveServicesAccountInner>> serviceCallback) {
        return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback);
    }
840253
public Observable<ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner>> listAvailableWafRuleSetsWithServiceResponseAsync() {
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        final String apiVersion = "2018-06-01";
        return service.listAvailableWafRuleSets(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner>>>() {
                @Override
                public Observable<ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner> clientResponse = listAvailableWafRuleSetsDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }
547849
public GetByProjectResponse getByProject(GetByProjectRequest request) {
    return call(
      new GetRequest(path("get_by_project"))
        .setParam("organization", request.getOrganization())
        .setParam("project", request.getProject()),
      GetByProjectResponse.parser());
  }
267072
public PubsubFuture<List<ReceivedMessage>> pull(final String project, final String subscription) {
    return pull(project, subscription, DEFAULT_PULL_RETURN_IMMEDIATELY, DEFAULT_PULL_MAX_MESSAGES);
  }