// GetActivation populates the Activation resource
//
// API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getanactivation
// Endpoint: GET /papi/v1/properties/{propertyId}/activations/{activationId}{?contractId,groupId}
483592
func (activation *Activation) GetActivation(property *Property) (time.Duration, error) {
	req, err := client.NewRequest(
		Config,
		"GET",
		fmt.Sprintf(
			"/papi/v1/properties/%s/activations/%s",
			property.PropertyID,
			activation.ActivationID,
		),
		nil,
	)

	if err != nil {
		return 0, err
	}

	res, err := client.Do(Config, req)
	if err != nil {
		return 0, err
	}

	if client.IsError(res) {
		return 0, client.NewAPIError(res)
	}

	activations := NewActivations()
	if err := client.BodyJSON(res, activations); err != nil {
		return 0, err
	}

	activation.ActivationID = activations.Activations.Items[0].ActivationID
	activation.ActivationType = activations.Activations.Items[0].ActivationType
	activation.AcknowledgeWarnings = activations.Activations.Items[0].AcknowledgeWarnings
	activation.ComplianceRecord = activations.Activations.Items[0].ComplianceRecord
	activation.FastPush = activations.Activations.Items[0].FastPush
	activation.IgnoreHTTPErrors = activations.Activations.Items[0].IgnoreHTTPErrors
	activation.PropertyName = activations.Activations.Items[0].PropertyName
	activation.PropertyID = activations.Activations.Items[0].PropertyID
	activation.PropertyVersion = activations.Activations.Items[0].PropertyVersion
	activation.Network = activations.Activations.Items[0].Network
	activation.Status = activations.Activations.Items[0].Status
	activation.SubmitDate = activations.Activations.Items[0].SubmitDate
	activation.UpdateDate = activations.Activations.Items[0].UpdateDate
	activation.Note = activations.Activations.Items[0].Note
	activation.NotifyEmails = activations.Activations.Items[0].NotifyEmails

	//retry, _ := strconv.Atoi(res.Header.Get("Retry-After"))
	//retry *= int(time.Second)

	return time.Duration(30 * time.Second), nil
}
659205
func (c *Client) ActivateProject(p *ActivateProjectParameter) (*Project, error) {
	obj, err := c.Request("activateProject", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Project), err
}
1122787
func (r *routerRPC) Activate(ctx context.Context, req *pb.DeviceActivationRequest) (*pb.DeviceActivationResponse, error) {
	gateway, err := r.gatewayFromContext(ctx)
	if err != nil {
		return nil, err
	}
	if err := req.Validate(); err != nil {
		return nil, errors.Wrap(err, "Invalid Activation Request")
	}
	if r.uplinkRate.Limit(gateway.ID) {
		return nil, grpc.Errorf(codes.ResourceExhausted, "Gateway reached uplink rate limit")
	}
	return r.router.HandleActivation(gateway.ID, req)
}
380979
func (s *CreateIPSetInput) SetActivate(v bool) *CreateIPSetInput {
	s.Activate = &v
	return s
}
886945
func (s *CommonStorageDB) GetPrivateData(namespace, collection, key string) (*statedb.VersionedValue, error) {
	return s.GetState(derivePvtDataNs(namespace, collection), key)
}
1365457
func (c *DefaultClient) UnsubscribeAppActivations(appID string) Token {
	return c.UnsubscribeDeviceEvents(appID, "", types.ActivationEvent)
}
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
}
520446
func GetApplication(params base.Parameters) *cli.Application {
	return &cli.Application{
		Name:  "lucicfg",
		Title: "LUCI config generator (" + lucicfg.UserAgent + ")",

		Context: func(ctx context.Context) context.Context {
			loggerConfig := gologger.LoggerConfig{
				Format: `[P%{pid} %{time:15:04:05.000} %{shortfile} %{level:.1s}] %{message}`,
				Out:    os.Stderr,
			}
			return loggerConfig.Use(ctx)
		},

		Commands: []*subcommands.Command{
			subcommands.Section("Config generation\n"),
			generate.Cmd(params),
			validate.Cmd(params),

			subcommands.Section("Aiding in the migration\n"),
			diff.Cmd(params),

			subcommands.Section("Authentication for LUCI Config\n"),
			authcli.SubcommandInfo(params.AuthOptions, "auth-info", true),
			authcli.SubcommandLogin(params.AuthOptions, "auth-login", false),
			authcli.SubcommandLogout(params.AuthOptions, "auth-logout", false),

			subcommands.Section("Misc\n"),
			subcommands.CmdHelp,
			versioncli.CmdVersion(lucicfg.UserAgent),
		},
	}
}
1258736
func (s *userServiceImpl) RescheduleDeactivation(ctx context.Context, identityID uuid.UUID) error {
	rescheduledDeactivation := time.Now().Add(s.config.GetUserDeactivationRescheduleDelay())

	err := s.ExecuteInTransaction(func() error {
		return s.Repositories().Identities().BumpDeactivationSchedule(ctx, identityID, rescheduledDeactivation)
	})

	return err
}
1120400
func (s *InstanceInformation) SetActivationId(v string) *InstanceInformation {
	s.ActivationId = &v
	return s
}
495024
func (i *InstallationRepositoriesEvent) GetAction() string {
	if i == nil || i.Action == nil {
		return ""
	}
	return *i.Action
}
10984
func (m *MarketplacePurchaseEvent) GetAction() string {
	if m == nil || m.Action == nil {
		return ""
	}
	return *m.Action
}
957641
func (a *AccountService) Deactivate(accountURL string) error {
	if len(accountURL) == 0 {
		return errors.New("account[deactivate]: empty URL")
	}

	req := acme.Account{Status: acme.StatusDeactivated}
	_, err := a.core.post(accountURL, req, nil)
	return err
}
1305578
func (c *ConfigurationData) GetUserDeactivationInactivityPeriodDays() time.Duration {
	return time.Duration(c.v.GetInt(varUserDeactivationInactivityPeriodDays)) * 24 * time.Hour
}
21244
func (qrs *Rules) GetAction(ip, user string, bindVars map[string]*querypb.BindVariable) (action Action, desc string) {
	for _, qr := range qrs.rules {
		if act := qr.GetAction(ip, user, bindVars); act != QRContinue {
			return act, qr.Description
		}
	}
	return QRContinue, ""
}
308202
func (g *GitHubAppAuthorizationEvent) GetAction() string {
	if g == nil || g.Action == nil {
		return ""
	}
	return *g.Action
}
833261
func NewActivation(parent *Activations) *Activation {
	activation := &Activation{parent: parent}
	activation.Init()

	return activation
}