// fillServiceOfferingID fills the service offering identifier based on name.
// If no matching service offering is found, ID remains unchanged and an error is returned.
170403
func (vm *VM) fillServiceOfferingID() error {

	params := url.Values{}
	params.Set("name", strings.ToLower(string(vm.ServiceOffering.Name)))

	client := vm.getExoClient()
	resp, err := client.Request("listServiceOfferings", params)
	if err != nil {
		return fmt.Errorf("Getting service offering ID for %q: %s", vm.ServiceOffering.Name, err)
	}

	so := &egoscale.ListServiceOfferingsResponse{}
	if err := json.Unmarshal(resp, so); err != nil {
		return fmt.Errorf("Decoding response for service offering %q: %s", vm.ServiceOffering.Name, err)
	}

	if so.Count != 1 {
		return fmt.Errorf("Expected 1 service offering matching %q, but returned %d", vm.ServiceOffering.Name, so.Count)
	}

	vm.ServiceOffering.ID = so.ServiceOfferings[0].Id

	return nil
}
87532
func (client *Client) DeleteServiceBinding(serviceBindingGUID string, acceptsIncomplete bool) (ServiceBinding, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.DeleteServiceBindingRequest,
		URIParams:   map[string]string{"service_binding_guid": serviceBindingGUID},
		Query:       url.Values{"accepts_incomplete": {fmt.Sprint(acceptsIncomplete)}},
	})
	if err != nil {
		return ServiceBinding{}, nil, err
	}

	var response cloudcontroller.Response
	var serviceBinding ServiceBinding
	if acceptsIncomplete {
		response = cloudcontroller.Response{
			DecodeJSONResponseInto: &serviceBinding,
		}
	}

	err = client.connection.Make(request, &response)
	return serviceBinding, response.Warnings, err
}
236443
func (s *Server) GetServiceDetailsByTenantID(tenantID string, response *[]service.ServiceDetails) error {
	svcs, err := s.f.GetServiceDetailsByTenantID(s.context(), tenantID)
	if err != nil {
		return err
	}
	*response = svcs
	return nil
}
263546
func NewIDService(ctx context.Context, h host.Host) *IDService {
	s := &IDService{
		Host:          h,
		ctx:           ctx,
		currid:        make(map[inet.Conn]chan struct{}),
		observedAddrs: NewObservedAddrSet(ctx),
	}
	h.SetStreamHandler(ID, s.requestHandler)
	h.SetStreamHandler(IDPush, s.pushHandler)
	h.Network().Notify((*netNotifiee)(s))
	return s
}
276694
func (s *SetIdentityPoolConfigurationOutput) SetIdentityPoolId(v string) *SetIdentityPoolConfigurationOutput {
	s.IdentityPoolId = &v
	return s
}
439730
func (s *Service) ServiceID(w http.ResponseWriter, r *http.Request) {
	id, err := paramID("kid", r)
	if err != nil {
		Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
		return
	}

	srcID, err := paramID("id", r)
	if err != nil {
		Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
		return
	}

	ctx := r.Context()
	srv, err := s.Store.Servers(ctx).Get(ctx, id)
	if err != nil || srv.SrcID != srcID || srv.Type == "" {
		notFound(w, id, s.Logger)
		return
	}

	res := newService(srv)
	encodeJSON(w, http.StatusOK, res, s.Logger)
}
1335578
func (idp *IdentityProvider) ServeIDPInitiated(w http.ResponseWriter, r *http.Request, serviceProviderID string, relayState string) {
	req := &IdpAuthnRequest{
		IDP:         idp,
		HTTPRequest: r,
		RelayState:  relayState,
		Now:         TimeNow(),
	}

	session := idp.SessionProvider.GetSession(w, r, req)
	if session == nil {
		// If GetSession returns nil, it must have written an HTTP response, per the interface
		// (this is probably because it drew a login form or something)
		return
	}

	var err error
	req.ServiceProviderMetadata, err = idp.ServiceProviderProvider.GetServiceProvider(r, serviceProviderID)
	if err == os.ErrNotExist {
		idp.Logger.Printf("cannot find service provider: %s", serviceProviderID)
		http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
		return
	} else if err != nil {
		idp.Logger.Printf("cannot find service provider %s: %v", serviceProviderID, err)
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}

	// find an ACS endpoint that we can use
	for _, spssoDescriptor := range req.ServiceProviderMetadata.SPSSODescriptors {
		for _, endpoint := range spssoDescriptor.AssertionConsumerServices {
			if endpoint.Binding == HTTPPostBinding {
				req.ACSEndpoint = &endpoint
				req.SPSSODescriptor = &spssoDescriptor
				break
			}
		}
		if req.ACSEndpoint != nil {
			break
		}
	}
	if req.ACSEndpoint == nil {
		idp.Logger.Printf("saml metadata does not contain an Assertion Customer Service url")
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}

	assertionMaker := idp.AssertionMaker
	if assertionMaker == nil {
		assertionMaker = DefaultAssertionMaker{}
	}
	if err := assertionMaker.MakeAssertion(req, session); err != nil {
		idp.Logger.Printf("failed to make assertion: %s", err)
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}

	if err := req.WriteResponse(w); err != nil {
		idp.Logger.Printf("failed to write response: %s", err)
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}
}
63037
func (c *Client) UpdateServiceOffering(p *UpdateServiceOfferingParameter) (*ServiceOffering, error) {
	obj, err := c.Request("updateServiceOffering", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*ServiceOffering), err
}
1212946
func (s *DeleteServiceSpecificCredentialInput) SetServiceSpecificCredentialId(v string) *DeleteServiceSpecificCredentialInput {
	s.ServiceSpecificCredentialId = &v
	return s
}
295221
func (c *Client) CreateServicePlanVisibilityByUniqueId(uniqueId string, organizationGuid string) (ServicePlanVisibility, error) {
	q := url.Values{}
	q.Set("q", fmt.Sprintf("unique_id:%s", uniqueId))
	plans, err := c.ListServicePlansByQuery(q)
	if err != nil {
		return ServicePlanVisibility{}, errors.Wrap(err, fmt.Sprintf("Couldn't find a service plan with unique_id: %s", uniqueId))
	}
	return c.CreateServicePlanVisibility(plans[0].Guid, organizationGuid)
}
107310
func (s *Server) GetTenantID(serviceID string, tenantId *string) error {
	result, err := s.f.GetTenantID(s.context(), serviceID)
	if err != nil {
		return err
	}
	*tenantId = result
	return nil
}
1163372
func ParseServiceID(svc *types.Service) ServiceID {
	return ServiceID{
		Name:      svc.ObjectMeta.Name,
		Namespace: svc.ObjectMeta.Namespace,
	}
}
714441
func (r *RegisterMonitor) serviceID() string {
	id := fmt.Sprintf("%s-proxy", r.Service)
	if r.IDSuffix != "" {
		id += "-" + r.IDSuffix
	}

	return id
}
1211928
func identityRoleFilterByIdentityID(identityID uuid.UUID) func(db *gorm.DB) *gorm.DB {
	return func(db *gorm.DB) *gorm.DB {
		return db.Where("identity_id = ?", identityID)
	}
}
271864
func (s *ServiceSpecificCredential) SetServiceSpecificCredentialId(v string) *ServiceSpecificCredential {
	s.ServiceSpecificCredentialId = &v
	return s
}
51123
func (s *DescribeReservationOutput) SetOfferingId(v string) *DescribeReservationOutput {
	s.OfferingId = &v
	return s
}
1020764
func (c *Client) CreateServiceOffering(p *CreateServiceOfferingParameter) (*ServiceOffering, error) {
	obj, err := c.Request("createServiceOffering", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*ServiceOffering), err
}