// CloudformationLink returns the cloudformation link for us
345362
func (t *LaunchTemplate) CloudformationLink() *cloudformation.Literal {
	return cloudformation.Ref("AWS::EC2::LaunchTemplate", fi.StringValue(t.Name))
}
693816
func (s *clusterService) LinkIdentityToCluster(ctx context.Context, identityID uuid.UUID, clusterURL string, options ...rest.HTTPClientOption) error {
	signer := newJWTSASigner(ctx, s.config, options...)
	remoteClusterService, err := signer.createSignedClient()
	if err != nil {
		return errors.Wrapf(err, "failed to create JWT signer for cluster service")
	}
	identityToClusterData := &clusterclient.LinkIdentityToClusterData{
		ClusterURL: clusterURL,
		IdentityID: identityID.String(),
	}
	res, err := remoteClusterService.LinkIdentityToClusterClusters(goasupport.ForwardContextRequestID(ctx), clusterclient.LinkIdentityToClusterClustersPath(), identityToClusterData)
	if err != nil {
		return errors.Wrapf(err, "failed to link identity %s to cluster having url %s", identityID, clusterURL)
	}
	defer rest.CloseResponse(res)
	bodyString := rest.ReadBody(res.Body) // To prevent FDs leaks
	if res.StatusCode != http.StatusNoContent {
		log.Error(ctx, map[string]interface{}{
			"identity_id":     identityID,
			"cluster_url":     clusterURL,
			"response_status": res.Status,
			"response_body":   bodyString,
		}, "unable to link identity to cluster in cluster management service")
		return errors.Errorf("failed to link identity to cluster in cluster management service. Response status: %s. Response body: %s", res.Status, bodyString)
	}
	return nil
}
165547
func (repo *Repository) AvatarLink() string {
	link := repo.RelAvatarLink()
	if link[0] == '/' && link[1] != '/' {
		return setting.AppURL + strings.TrimPrefix(link, setting.AppSubURL)[1:]
	}
	return link
}
549071
func NewSharedLinkShareType(Description string) *SharedLinkShareType {
	s := new(SharedLinkShareType)
	s.Description = Description
	return s
}
1186260
func (c *TokenController) Link(ctx *app.LinkTokenContext) error {
	if ctx.For == "" {
		return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("for", "").Expected("git or OpenShift resource URL"))
	}
	currentIdentity, err := c.app.UserService().ContextIdentityIfExists(ctx)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}

	var redirectURL string
	if ctx.Redirect == nil {
		redirectURL = ctx.RequestData.Header.Get("Referer")
		if redirectURL == "" {
			return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("redirect", "empty").Expected("redirect param or Referer header should be specified"))
		}
	} else {
		redirectURL = *ctx.Redirect
	}

	redirectLocation, err := c.app.LinkService().ProviderLocation(ctx, ctx.RequestData, currentIdentity.String(), ctx.For, redirectURL)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}

	locationPayload := &app.RedirectLocation{RedirectLocation: redirectLocation}
	return ctx.OK(locationPayload)
}
633098
func BuilderIDLink(b, project string) string {
	parts := strings.Split(b, "/")
	if len(parts) != 3 {
		return InvalidBuilderIDURL
	}

	switch source := parts[0]; source {
	case "buildbot":
		return fmt.Sprintf("/buildbot/%s/%s", parts[1], parts[2])
	case "buildbucket":
		return fmt.Sprintf("/p/%s/builders/%s/%s", project, parts[1], parts[2])
	default:
		return InvalidBuilderIDURL
	}
}
13675
func (indexRef *IndexReference) GetCloudMetadataWithFormat(cons LookupConstraint, format string, requireSigned bool) (*CloudMetadata, error) {
	productFilesPath, err := indexRef.GetProductsPath(cons)
	if err != nil {
		return nil, err
	}
	logger.Tracef("finding products at path %q", productFilesPath)
	data, url, err := fetchData(indexRef.Source, productFilesPath, requireSigned)
	if err != nil {
		logger.Tracef("can't read product data: %v", err)
		return nil, fmt.Errorf("cannot read product data, %v", err)
	}
	return ParseCloudMetadata(data, format, url, indexRef.valueParams.ValueTemplate)
}
37403
func (g *CoordinatorLinkGenerator) GetLink(names ...types.StreamName) string {
	paths := make([]types.StreamPath, len(names))
	for i, name := range names {
		paths[i] = g.Prefix.AsPathPrefix(name)
	}
	return viewer.GetURL(g.Host, g.Project, paths...)
}
221767
func recipeLink(r *buildbucketpb.BuildInfra_Recipe) (result template.HTML) {
	if r == nil {
		return
	}
	// We don't know location of recipes within the repo and getting that
	// information is not trivial, so use code search, which is precise enough.
	csHost := "cs.chromium.org"
	if strings.HasPrefix(r.CipdPackage, "infra_internal") {
		csHost = "cs.corp.google.com"
	}
	recipeURL := fmt.Sprintf("https://%s/search/?q=file:recipes/%s.py", csHost, r.Name)
	return ui.NewLink(r.Name, recipeURL, fmt.Sprintf("recipe %s", r.Name)).HTML()
}
586111
func printLink(domain string) error {
	link, err := dnslink.Resolve(domain)
	if err != nil {
		return err
	}
	fmt.Println(link)
	return nil
}
700235
func (t *Template) GetAllAWSServiceCatalogCloudFormationProductResources() map[string]*resources.AWSServiceCatalogCloudFormationProduct {
	results := map[string]*resources.AWSServiceCatalogCloudFormationProduct{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSServiceCatalogCloudFormationProduct:
			results[name] = resource
		}
	}
	return results
}
720588
func (e EnumItemReference) Link(scope Scope, t TypeSpec) (ConstantValue, error) {
	if RootTypeSpec(t) != e.Enum {
		return nil, constantValueCastError{Value: e, Type: t}
	}
	return e, nil
}
1045839
func NewSharedLink(Url string) *SharedLink {
	s := new(SharedLink)
	s.Url = Url
	return s
}
1144092
func (c *ALIModelContext) LinkToNatGateway() *alitasks.NatGateway {
	return &alitasks.NatGateway{Name: s(c.GetNameForNatGateway())}
}
690605
func (c *VSphereCloud) CreateLinkClonedVm(vmName, vmImage *string) (string, error) {
	f := find.NewFinder(c.Client.Client, true)
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	dc, err := f.Datacenter(ctx, c.Datacenter)
	if err != nil {
		return "", err
	}
	f.SetDatacenter(dc)

	templateVm, err := f.VirtualMachine(ctx, *vmImage)
	if err != nil {
		return "", err
	}

	glog.V(2).Infof("Template VM ref is %+v", templateVm)
	datacenterFolders, err := dc.Folders(ctx)
	if err != nil {
		return "", err
	}

	// Create snapshot of the template VM if not already snapshotted.
	snapshot, err := createSnapshot(ctx, templateVm, snapshotName, snapshotDesc)
	if err != nil {
		return "", err
	}

	clsComputeRes, err := f.ClusterComputeResource(ctx, c.Cluster)
	glog.V(4).Infof("Cluster compute resource is %+v", clsComputeRes)
	if err != nil {
		return "", err
	}

	resPool, err := clsComputeRes.ResourcePool(ctx)
	glog.V(4).Infof("Cluster resource pool is %+v", resPool)
	if err != nil {
		return "", err
	}

	if resPool == nil {
		return "", errors.New(fmt.Sprintf("No resource pool found for cluster %s", c.Cluster))
	}

	resPoolRef := resPool.Reference()
	snapshotRef := snapshot.Reference()

	cloneSpec := &types.VirtualMachineCloneSpec{
		Config: &types.VirtualMachineConfigSpec{
			Flags: &types.VirtualMachineFlagInfo{
				DiskUuidEnabled: fi.Bool(true),
			},
		},
		Location: types.VirtualMachineRelocateSpec{
			Pool:         &resPoolRef,
			DiskMoveType: "createNewChildDiskBacking",
		},
		Snapshot: &snapshotRef,
	}

	// Create a link cloned VM from the template VM's snapshot
	clonedVmTask, err := templateVm.Clone(ctx, datacenterFolders.VmFolder, *vmName, *cloneSpec)
	if err != nil {
		return "", err
	}

	clonedVmTaskInfo, err := clonedVmTask.WaitForResult(ctx, nil)
	if err != nil {
		return "", err
	}

	clonedVm := clonedVmTaskInfo.Result.(object.Reference)
	glog.V(2).Infof("Created VM %s successfully", clonedVm)

	return clonedVm.Reference().Value, nil
}
214492
func (i *LocalInstaller) link(from string) error {
	origin, err := filepath.Abs(from)
	if err != nil {
		return err
	}
	dest, err := filepath.Abs(i.Path())
	if err != nil {
		return err
	}
	return os.Symlink(origin, dest)
}
1341469
func (k *SimpleFS) SimpleFSSymlink(ctx context.Context, arg keybase1.SimpleFSSymlinkArg) (err error) {
	// This is not async.
	ctx, err = k.startSyncOp(ctx, "Symlink", arg)
	if err != nil {
		return err
	}
	defer func() { k.doneSyncOp(ctx, err) }()

	destFS, finalDestElem, err := k.getFS(ctx, arg.Link)
	if err != nil {
		return err
	}

	err = destFS.Symlink(arg.Target, finalDestElem)
	return err
}