// GetPublicRepos returns the PublicRepos field if it's non-nil, zero value otherwise.
3090
func (u *User) GetPublicRepos() int {
	if u == nil || u.PublicRepos == nil {
		return 0
	}
	return *u.PublicRepos
}
1287974
func (api *API) CreatePublicIp(ip_type string, reverse_dns string, datacenter_id string) (string, *PublicIp, error) {
	res := new(PublicIp)
	url := createUrl(api, publicIpPathSegment)
	req := struct {
		DatacenterId string `json:"datacenter_id,omitempty"`
		ReverseDns   string `json:"reverse_dns,omitempty"`
		Type         string `json:"type,omitempty"`
	}{DatacenterId: datacenter_id, ReverseDns: reverse_dns, Type: ip_type}
	err := api.Client.Post(url, &req, &res, http.StatusCreated)
	if err != nil {
		return "", nil, err
	}
	res.api = api
	return res.Id, res, nil
}
225860
func (az *Cloud) DeletePublicIP(service *v1.Service, pipResourceGroup string, pipName string) error {
	if az.Config.shouldOmitCloudProviderBackoff() {
		ctx, cancel := getContextWithCancel()
		defer cancel()

		resp, err := az.PublicIPAddressesClient.Delete(ctx, pipResourceGroup, pipName)
		return az.processHTTPResponse(service, "DeletePublicIPAddress", resp, err)
	}

	return az.deletePublicIPWithRetry(service, pipResourceGroup, pipName)
}
1065516
func (u *User) GetTotalPrivateRepos() int {
	if u == nil || u.TotalPrivateRepos == nil {
		return 0
	}
	return *u.TotalPrivateRepos
}
181020
func (p *ProjectOptions) GetPublic() bool {
	if p == nil || p.Public == nil {
		return false
	}
	return *p.Public
}
1190275
func (o *oracleInstance) unusedPublicIps() ([]response.IpReservation, error) {
	filter := []oci.Filter{
		{
			Arg:   "permanent",
			Value: "true",
		},
		{
			Arg:   "used",
			Value: "false",
		},
	}

	res, err := o.env.client.AllIpReservations(filter)
	if err != nil {
		return nil, err
	}

	return res.Result, nil
}
198630
func (crud *repo) FindByPublicId(publicId string) (profile service.Entity, err error) {
	if err = dbconn.DB.Where("public_id = ?", publicId).First(&profile).Error; err != nil {
		return service.Entity{}, err
	}
	return profile, nil
}
1296881
func (s *service) GetResourceOwnerId(publicId string) (userId uint) {
	entity, err := s.repo.FindByPublicId(publicId)
	if err != nil {
		return 0
	}
	return entity.UserID
}
774943
func (u *User) GetPublicKeyByLabel(label string) (publicKey PublicKey, err error) {
	for _, publicKey = range u.PublicKeys {
		if publicKey.Label == label {
			return
		}
	}
	err = errors.New("Could not find PublicKey with label " + label)
	return
}
549787
func NewPublicPriceAPI(client *Client) *PublicPriceAPI {
	return &PublicPriceAPI{
		&baseAPI{
			client: client,
			FuncGetResourceURL: func() string {
				return "public/price"
			},
		},
	}
}
1015632
func (pssapi *API) GetPublicKey() (keybytes hexutil.Bytes) {
	key := pssapi.Pss.PublicKey()
	keybytes = crypto.FromECDSAPub(key)
	return keybytes
}
778536
func (k SigningSecretKey) GetRawPublicKey() *[ed25519.PublicKeySize]byte {
	return (*[ed25519.PublicKeySize]byte)(&k.pub)
}
990700
func (db *db) GetRepository(ctx context.Context, repoURL string) (*appsv1.Repository, error) {
	s, err := db.settingsMgr.GetSettings()
	if err != nil {
		return nil, err
	}

	index := getRepositoryIndex(s, repoURL)
	if index < 0 {
		return nil, status.Errorf(codes.NotFound, "repo '%s' not found", repoURL)
	}

	repo, err := db.credentialsToRepository(s.Repositories[index])

	if err != nil {
		return nil, err
	}

	if !repo.HasCredentials() {
		index := getRepositoryCredentialIndex(s, repoURL)
		if index >= 0 {

			credential, err := db.credentialsToRepository(s.RepositoryCredentials[index])

			if err != nil {
				return nil, err
			} else {
				log.WithFields(log.Fields{"repoURL": repo.Repo, "credUrl": credential.Repo}).Info("copying credentials")
				repo.CopyCredentialsFrom(*credential)
			}
		}
	}

	return repo, err
}
1162641
func (m *Machine) PublicAddress() (network.Address, error) {
	publicAddress := m.doc.PreferredPublicAddress.networkAddress()
	var err error
	if publicAddress.Value == "" {
		err = network.NoAddressError("public")
	}
	return publicAddress, err
}
760844
func (u *User) GetReposURL() string {
	if u == nil || u.ReposURL == nil {
		return ""
	}
	return *u.ReposURL
}
879560
func (c *Client) ServerPublicKeyBlobRef() (blob.Ref, error) {
	if err := c.condDiscovery(); err != nil {
		return blob.Ref{}, err
	}

	if !c.serverPublicKeyBlobRef.Valid() {
		return blob.Ref{}, ErrNoSigning
	}
	return c.serverPublicKeyBlobRef, nil
}
411502
func GetPublicKey(c *context.APIContext) {
	key, err := models.GetPublicKeyByID(c.ParamsInt64(":id"))
	if err != nil {
		if models.IsErrKeyNotExist(err) {
			c.Status(404)
		} else {
			c.Error(500, "GetPublicKeyByID", err)
		}
		return
	}

	apiLink := composePublicKeysAPILink()
	c.JSON(200, convert.ToPublicKey(apiLink, key))
}