// TermsOfService can be used in: API
//
// TermsOfService describes the API terms of services or links to them.
424535
func TermsOfService(terms string) {
	if a, ok := apiDefinition(); ok {
		a.TermsOfService = terms
	}
}
1191948
func (client *Client) GetService() (*GetServiceResp, error) {
	bucket := client.Bucket("")

	r, err := bucket.Get("")
	if err != nil {
		return nil, err
	}

	// Parse the XML response.
	var resp GetServiceResp
	if err = xml.Unmarshal(r, &resp); err != nil {
		return nil, err
	}

	return &resp, nil
}
44007
func (msg *MsgVersion) HasService(service ServiceFlag) bool {
	return msg.Services&service == service
}
502228
func (l *State) AddService(service *structs.NodeService, token string) error {
	l.Lock()
	defer l.Unlock()
	return l.addServiceLocked(service, token)
}
392710
func (a *Accessory) AddService(s *service.Service) {
	a.Services = append(a.Services, s)
}
922596
func (client *Client) GetServices(filters ...Filter) ([]Service, Warnings, error) {
	opts := requestOptions{
		RequestName: internal.GetServicesRequest,
		Query:       ConvertFilterParameters(filters),
	}

	return client.makeServicesRequest(opts)
}
103475
func (a *api) GetService(id string) (*service.Service, error) {
	client, err := a.connectDAO()
	if err != nil {
		return nil, err
	}

	var s service.Service
	if err := client.GetService(id, &s); err != nil {
		return nil, err
	}

	return &s, nil
}
358919
func (c *Client) GetServices(ctx context.Context) (map[string]string, error) {
	var services map[string]string

	req, err := c.NewRequest("GET", servicesPath, nil, nil)
	if err != nil {
		return nil, err
	}

	if err := c.Do(ctx, req, &services); err != nil {
		return nil, err
	}

	return services, err
}
686179
func (c *AvailableConditionController) addService(obj interface{}) {
	for _, apiService := range c.getAPIServicesFor(obj.(*v1.Service)) {
		c.enqueue(apiService)
	}
}
475251
func resolveService(src ast.ServiceReference, scope Scope) (*ServiceSpec, error) {
	s, err := scope.LookupService(src.Name)
	if err == nil {
		err = s.Link(scope)
		return s, err
	}

	mname, iname := splitInclude(src.Name)
	if len(mname) == 0 {
		return nil, referenceError{
			Target:    src.Name,
			Line:      src.Line,
			ScopeName: scope.GetName(),
			Reason:    err,
		}
	}

	includedScope, err := getIncludedScope(scope, mname)
	if err != nil {
		return nil, referenceError{
			Target:    src.Name,
			Line:      src.Line,
			ScopeName: scope.GetName(),
			Reason:    err,
		}
	}

	return resolveService(ast.ServiceReference{Name: iname}, includedScope)
}
1017240
func (c *CloudService) CloudService() (*CloudService, error) {
	doc, err := c.cloudServiceDoc()
	if err != nil {
		return nil, errors.Trace(err)
	}
	if doc == nil {
		return nil, errors.NotFoundf("cloud service %v", c.Id())
	}
	c.doc = *doc
	return c, nil
}
1248501
func initService(service *goa.Service) {
	// Setup encoders and decoders
	service.Encoder.Register(goa.NewJSONEncoder, "application/json")
	service.Encoder.Register(goa.NewGobEncoder, "application/gob", "application/x-gob")
	service.Encoder.Register(goa.NewXMLEncoder, "application/xml")
	service.Decoder.Register(goa.NewJSONDecoder, "application/json")
	service.Decoder.Register(goa.NewGobDecoder, "application/gob", "application/x-gob")
	service.Decoder.Register(goa.NewXMLDecoder, "application/xml")

	// Setup default encoder and decoder
	service.Encoder.Register(goa.NewJSONEncoder, "*/*")
	service.Decoder.Register(goa.NewJSONDecoder, "*/*")
}
775276
func serviceToAgentService(svc *structs.ServiceDefinition) (*api.AgentServiceRegistration, error) {
	// mapstructure can do this for us, but we encapsulate it in this
	// helper function in case we need to change the logic in the future.
	var result api.AgentServiceRegistration
	d, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
		Result:           &result,
		DecodeHook:       timeDurationToStringHookFunc(),
		WeaklyTypedInput: true,
	})
	if err != nil {
		return nil, err
	}
	if err := d.Decode(svc); err != nil {
		return nil, err
	}

	// The structs version has non-pointer checks and the destination
	// has pointers, so we need to set the destination to nil if there
	// is no check ID set.
	if result.Check != nil && result.Check.Name == "" {
		result.Check = nil
	}
	if len(result.Checks) == 1 && result.Checks[0].Name == "" {
		result.Checks = nil
	}

	return &result, nil
}
383200
func (c *Client) GetService(serviceID string) (*service.Service, error) {
	svc := &service.Service{}
	err := c.call("GetService", serviceID, svc)
	return svc, err
}
663293
func (c *Context) Service() *Service {
	s, _ := serviceByName(c.ServiceName)
	return s
}
523085
func (client *Client) GetService(serviceGUID string) (Service, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetServiceRequest,
		URIParams:   Params{"service_guid": serviceGUID},
	})
	if err != nil {
		return Service{}, nil, err
	}

	var service Service
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &service,
	}

	err = client.connection.Make(request, &response)
	return service, response.Warnings, err
}
1075061
func (na *NetAddress) HasService(service ServiceFlag) bool {
	return na.Services&service == service
}