// FindApprovalRequest finds an approval request given its uuid.
332675
func (authy *Authy) FindApprovalRequest(uuid string, params url.Values) (*ApprovalRequest, error) {
	path := fmt.Sprintf("/onetouch/json/approval_requests/%s", uuid)
	response, err := authy.DoRequest("GET", path, params)
	if err != nil {
		return nil, err
	}

	defer closeResponseBody(response)
	approvalRequest, err := NewApprovalRequest(response)
	if err != nil {
		return nil, err
	}

	approvalRequest.UUID = uuid
	return approvalRequest, nil
}
718557
func (session *SafeSession) AutocommitApproval() bool {
	session.mu.Lock()
	defer session.mu.Unlock()

	if session.autocommitState == autocommitted {
		panic("BUG: AutocommitToken: unexpected autocommit state")
	}

	if session.autocommitState == autocommittable && len(session.ShardSessions) == 0 {
		session.autocommitState = autocommitted
		return true
	}
	return false
}
676645
func (client *Client) GetApplication(guid string) (Application, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetAppRequest,
		URIParams:   Params{"app_guid": guid},
	})
	if err != nil {
		return Application{}, nil, err
	}

	var app Application
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &app,
	}

	err = client.connection.Make(request, &response)
	return app, response.Warnings, err
}
475244
func (m *MockLambdaAPI) GetFunctionRequest(arg0 *lambda.GetFunctionInput) (*request.Request, *lambda.GetFunctionOutput) {
	ret := m.ctrl.Call(m, "GetFunctionRequest", arg0)
	ret0, _ := ret[0].(*request.Request)
	ret1, _ := ret[1].(*lambda.GetFunctionOutput)
	return ret0, ret1
}
897846
func (client *Client) GetApplicationTasks(appGUID string, query ...Query) ([]Task, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetApplicationTasksRequest,
		URIParams: internal.Params{
			"app_guid": appGUID,
		},
		Query: query,
	})
	if err != nil {
		return nil, nil, err
	}

	var fullTasksList []Task
	warnings, err := client.paginate(request, Task{}, func(item interface{}) error {
		if task, ok := item.(Task); ok {
			fullTasksList = append(fullTasksList, task)
		} else {
			return ccerror.UnknownObjectInListError{
				Expected:   Task{},
				Unexpected: item,
			}
		}
		return nil
	})

	return fullTasksList, warnings, err
}
701573
func (m *Manager) getAuthorizationRequest(authorizationcode string) (ar *authorizationRequest, err error) {
	ar = &authorizationRequest{}

	err = m.getAuthorizationRequestCollection().Find(bson.M{"authorizationcode": authorizationcode}).One(ar)
	if err != nil && err == mgo.ErrNotFound {
		ar = nil
		err = nil
		return
	}
	return
}
429776
func (api *Client) GetApplications(query ...*GetApplicationsQuery) ([]*Application, error) {
	var options *GetApplicationsQuery
	if len(query) > 0 {
		options = query[0]
	}
	result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(applicationsPath), &[]*Application{}, options)
	if err != nil {
		return nil, err
	}
	return *(result.(*[]*Application)), nil
}
1097398
func Get(id string, params *stripe.ApplicationFeeParams) (*stripe.ApplicationFee, error) {
	return getC().Get(id, params)
}
588018
func (api *API) AccessApplication(zoneID, applicationID string) (AccessApplication, error) {
	uri := fmt.Sprintf(
		"/zones/%s/access/apps/%s",
		zoneID,
		applicationID,
	)

	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return AccessApplication{}, errors.Wrap(err, errMakeRequestError)
	}

	var accessApplicationDetailResponse AccessApplicationDetailResponse
	err = json.Unmarshal(res, &accessApplicationDetailResponse)
	if err != nil {
		return AccessApplication{}, errors.Wrap(err, errUnmarshalError)
	}

	return accessApplicationDetailResponse.Result, nil
}
788121
func (s *SupportImpl) GetApplicationConfig(cid string) (channelconfig.Application, bool) {
	return s.PeerSupport.GetApplicationConfig(cid)
}
930863
func (p *RBACPolicyEnforcer) getProjectFromRequest(rvals ...interface{}) *v1alpha1.AppProject {
	if len(rvals) != 4 {
		return nil
	}
	getProjectByName := func(projName string) *v1alpha1.AppProject {
		proj, err := p.projLister.Get(projName)
		if err != nil {
			return nil
		}
		return proj
	}
	if res, ok := rvals[1].(string); ok {
		if obj, ok := rvals[3].(string); ok {
			switch res {
			case ResourceApplications:
				if objSplit := strings.Split(obj, "/"); len(objSplit) == 2 {
					return getProjectByName(objSplit[0])
				}
			case ResourceProjects:
				// we also automatically give project tokens and groups 'get' access to the project
				return getProjectByName(obj)
			}
		}
	}
	return nil
}
173165
func (obj *Global) GetAppEntryRaw(ctx context.Context, appID string) (json.RawMessage, error) {
	result := &struct {
		Entry json.RawMessage	`json:"qEntry"`
	} {}
	err := obj.rpc(ctx, "GetAppEntry", result, ensureEncodable(appID))
	return result.Entry, err 
}
136669
func (actor Actor) GetApplication(guid string) (Application, Warnings, error) {
	app, warnings, err := actor.CloudControllerClient.GetApplication(guid)

	if _, ok := err.(ccerror.ResourceNotFoundError); ok {
		return Application{}, Warnings(warnings), actionerror.ApplicationNotFoundError{GUID: guid}
	}

	return Application(app), Warnings(warnings), err
}
582458
func findAppPort(manifest *schema.PodManifest, portName types.ACName) (*types.Port, error) {
	var foundPort *types.Port

	for _, app := range manifest.Apps {
		for _, port := range app.App.Ports {
			if portName == port.Name {
				if foundPort != nil { // error: ambiguous
					return nil, fmt.Errorf("port name %q defined multiple apps", portName)
				}
				p := port // duplicate b/c port gets overwritten
				foundPort = &p
			}
		}
	}
	return foundPort, nil
}
1220415
func GetAppID(ctx ttnlog.Interface) string {
	appID := viper.GetString("app-id")
	if appID == "" {
		appData := readData(appFilename)
		id, ok := appData[idKey].(string)
		if !ok {
			ctx.Fatal("Invalid appID in config file.")
		}
		appID = id
	}

	if appID == "" {
		ctx.Fatal("Missing Application ID. You should select an application to use with \"ttnctl applications select\"")
	}

	if err := api.NotEmptyAndValidID(appID, "Application ID"); err != nil {
		ctx.Fatal(err.Error())
	}

	return appID
}
840930
func (kc *kubeClient) GetApplication(spaceName string, appName string) (*app.SimpleApp, error) {
	// Get all deployments of this app for each environment in this space
	deployments := []*app.SimpleDeployment{}
	for envName := range kc.envMap {
		// Only look for the application in environments where the user can deploy applications
		if kc.CanDeploy(envName) {
			deployment, err := kc.GetDeployment(spaceName, appName, envName)
			if err != nil {
				return nil, err
			} else if deployment != nil {
				deployments = append(deployments, deployment)
			}
		}
	}

	result := &app.SimpleApp{
		Type: "application",
		Attributes: &app.SimpleAppAttributes{
			Name:        appName,
			Deployments: deployments,
		},
		ID: appName,
	}
	return result, nil
}
978049
func (s *Service) GetVirtualHost(application, vhostName string) *servicedefinition.VHost {
	if s.Endpoints != nil {
		//find the matching endpoint
		for i := range s.Endpoints {
			ep := &s.Endpoints[i]

			if ep.Application == application && ep.Purpose == "export" {
				vhostNameLower := strings.ToLower(vhostName)
				for _, vhost := range ep.VHostList {
					if strings.ToLower(vhost.Name) == vhostNameLower {
						return &vhost
					}
				}
			}
		}
	}

	return nil
}