// Sends the Activation to the activation endpoint. For documentation on how this works, see:
// https://devcentral.f5.com/wiki/iControl.Licensing_activation_APIs.ashx
423411
func (b *BigIP) Activate(a Activation) error {
	return b.post(a, uriShared, uriLicensing, uriActivation)
}
383830
func (a *Account) activationExpired(subject string, kind jwt.ExportType) {
	switch kind {
	case jwt.Stream:
		a.streamActivationExpired(subject)
	case jwt.Service:
		a.serviceActivationExpired(subject)
	}
}
1100033
func (f *DefaultPooledObjectFactory) ActivateObject(ctx context.Context, object *PooledObject) error {
	if f.activate != nil {
		return f.activate(ctx, object)
	}
	return nil
}
839794
func (rc *Client) sendCCProposal(reqCtx reqContext.Context, ccProposalType chaincodeProposalType, channelID string, req InstantiateCCRequest, opts requestOptions) (fab.TransactionID, error) {
	if err := checkRequiredCCProposalParams(channelID, req); err != nil {
		return fab.EmptyTransactionID, err
	}

	targets, err := rc.getCCProposalTargets(channelID, opts)
	if err != nil {
		return fab.EmptyTransactionID, err
	}
	// Get transactor on the channel to create and send the deploy proposal
	channelService, err := rc.ctx.ChannelProvider().ChannelService(rc.ctx, channelID)
	if err != nil {
		return fab.EmptyTransactionID, errors.WithMessage(err, "Unable to get channel service")
	}

	transactor, err := channelService.Transactor(reqCtx)
	if err != nil {
		return fab.EmptyTransactionID, errors.WithMessage(err, "get channel transactor failed")
	}

	// create a transaction proposal for chaincode deployment
	tp, txnID, err := rc.createTP(req, channelID, ccProposalType)
	if err != nil {
		return txnID, err
	}

	// Process and send transaction proposal
	txProposalResponse, err := transactor.SendTransactionProposal(tp, peersToTxnProcessors(targets))
	if err != nil {
		return tp.TxnID, errors.WithMessage(err, "sending deploy transaction proposal failed")
	}

	// Verify signature(s)
	err = rc.verifyTPSignature(channelService, txProposalResponse)
	if err != nil {
		return tp.TxnID, errors.WithMessage(err, "sending deploy transaction proposal failed to verify signature")
	}

	eventService, err := channelService.EventService()
	if err != nil {
		return tp.TxnID, errors.WithMessage(err, "unable to get event service")
	}

	// send transaction and check event
	return rc.sendTransactionAndCheckEvent(eventService, tp, txProposalResponse, transactor, reqCtx)

}
255982
func (t *Transaction) sendAction(a *Action) error {
	switch a.kind {
	case commandAction:
		return t.conn.Send(a.name, a.args...)
	case scriptAction:
		return a.script.Send(t.conn, a.args...)
	}
	return nil
}
874191
func (r *httpVPackResponse) Endpoint() string {
	u := *r.resp.Request.URL
	u.Path = ""
	return u.String()
}
301362
func (s *ProjectService) ActivateProject(p *ActivateProjectParams) (*ActivateProjectResponse, error) {
	resp, err := s.cs.newRequest("activateProject", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ActivateProjectResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = getRawValue(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
395357
func BridgeAndActivate(params ActivationParams) (*ActivationResult, error) {
	if len(params.Devices) == 0 {
		return nil, errors.Errorf("no devices specified")
	}

	stanzas, err := Parse(params.Filename)

	if err != nil {
		return nil, err
	}

	origContent := FormatStanzas(FlattenStanzas(stanzas), 4)
	bridgedStanzas := Bridge(stanzas, params.Devices)
	bridgedContent := FormatStanzas(FlattenStanzas(bridgedStanzas), 4)

	if origContent == bridgedContent {
		return nil, nil // nothing to do; old == new.
	}

	cmd := activationCmd(origContent, bridgedContent, &params)

	environ := os.Environ()
	if params.DryRun {
		environ = append(environ, "DRYRUN=echo")
	}
	result, err := scriptrunner.RunCommand(cmd, environ, params.Clock, params.Timeout)

	activationResult := ActivationResult{
		Stderr: result.Stderr,
		Stdout: result.Stdout,
		Code:   result.Code,
	}

	if err != nil {
		return &activationResult, errors.Errorf("bridge activation error: %s", err)
	}

	logger.Infof("bridge activation result=%v", result.Code)

	if result.Code != 0 {
		logger.Errorf("bridge activation stdout\n%s\n", result.Stdout)
		logger.Errorf("bridge activation stderr\n%s\n", result.Stderr)
		// We want to suppress long output from ifup, ifdown - it will be shown in status message!
		if len(result.Stderr) < 40 {
			return &activationResult, errors.Errorf("bridge activation failed: %s", string(result.Stderr))
		} else {
			return &activationResult, errors.Errorf("bridge activation failed, see logs for details")
		}
	}

	logger.Tracef("bridge activation stdout\n%s\n", result.Stdout)
	logger.Tracef("bridge activation stderr\n%s\n", result.Stderr)

	return &activationResult, nil
}
1040347
func (c *Target) ActivateTarget(targetId string) (*gcdmessage.ChromeResponse, error) {
	var v TargetActivateTargetParams
	v.TargetId = targetId
	return c.ActivateTargetWithParams(&v)
}
414133
func (s *Server) SendDockerAction(req DockerActionRequest, unused *string) (err error) {
	err = s.f.SendDockerAction(s.context(), req.ServiceID, req.InstanceID, req.Action, req.Args)
	return
}
905509
func (d *transportDemuxer) registerEndpoint(netProtos []tcpip.NetworkProtocolNumber, protocol tcpip.TransportProtocolNumber, id TransportEndpointID, ep TransportEndpoint, reusePort bool) *tcpip.Error {
	for i, n := range netProtos {
		if err := d.singleRegisterEndpoint(n, protocol, id, ep, reusePort); err != nil {
			d.unregisterEndpoint(netProtos[:i], protocol, id, ep)
			return err
		}
	}

	return nil
}
52351
func (api *SIMAPI) Activate(id int64) (bool, error) {
	var (
		method = "PUT"
		uri    = fmt.Sprintf("%s/%d/sim/activate", api.getResourceURL(), id)
	)

	return api.modify(method, uri, nil)
}
134992
func (c *Verification) Send(m *VerifyMessageRequest) (*VerifyMessageResponse, error) {
	if len(m.Number) == 0 {
		return nil, errors.New("Invalid Number field specified")
	}

	if len(m.Brand) == 0 {
		return nil, errors.New("Invalid Brand field specified")
	}

	var verifyMessageResponse *VerifyMessageResponse

	if !c.client.useOauth {
		m.apiKey = c.client.apiKey
		m.apiSecret = c.client.apiSecret
	}

	var r *http.Request
	buf, err := json.Marshal(m)
	if err != nil {
		return nil, errors.New("invalid message struct - can not convert to JSON")
	}

	b := bytes.NewBuffer(buf)
	r, err = http.NewRequest("POST", apiRootv2+"/verify/json", b)
	if err != nil {
		return nil, err
	}

	r.Header.Add("Accept", "application/json")
	r.Header.Add("Content-Type", "application/json")

	resp, err := c.client.HTTPClient.Do(r)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	err = json.Unmarshal(body, &verifyMessageResponse)
	if err != nil {
		return nil, err
	}
	return verifyMessageResponse, nil
}
255059
func (c *Client) Send(ctx context.Context, req *Request, auth *discovery.AuthInfo) (Response, error) {
	reqToBeSent := *req.Request
	reqToBeSent.Authentication = auth
	payload, err := proto.Marshal(&reqToBeSent)
	if err != nil {
		return nil, errors.Wrap(err, "failed marshaling Request to bytes")
	}

	sig, err := c.signRequest(payload)
	if err != nil {
		return nil, errors.Wrap(err, "failed signing Request")
	}

	conn, err := c.createConnection()
	if err != nil {
		return nil, errors.Wrap(err, "failed connecting to discovery service")
	}

	cl := discovery.NewDiscoveryClient(conn)
	resp, err := cl.Discover(ctx, &discovery.SignedRequest{
		Payload:   payload,
		Signature: sig,
	})
	if err != nil {
		return nil, errors.Wrap(err, "discovery service refused our Request")
	}
	if n := len(resp.Results); n != req.lastIndex {
		return nil, errors.Errorf("Sent %d queries but received %d responses back", req.lastIndex, n)
	}
	return req.computeResponse(resp)
}
871870
func (c *Client) SendDockerAction(serviceID string, instanceID int, action string, args []string) error {
	req := DockerActionRequest{
		ServiceID:  serviceID,
		InstanceID: instanceID,
		Action:     action,
		Args:       args,
	}

	err := c.call("SendDockerAction", req, new(string))
	return err
}
381515
func (w *mlWriter) activatePlugin(tag string) {
	if p := w.context.plugins[tag]; p != nil {
		w.stack = append(w.stack, p)
	}
}
818724
func (c *DefaultClient) UnsubscribeDeviceActivations(appID string, devID string) Token {
	return c.UnsubscribeDeviceEvents(appID, devID, types.ActivationEvent)
}