// CategoriesGoCode returns the go code for a categories file
166560
func CategoriesCode(m *gen.Metadata) ([]byte, error) {
	var err error
	var buf bytes.Buffer

	t := template.New("Test Template")
	t, err = t.Parse(CategoriesTemplate)
	t.Execute(&buf, m)

	return buf.Bytes(), err
}
431422
func getCode(path string) (*CodeDescriptor, error) {
	if path == "" {
		return nil, errors.New("Cannot collect files from empty chaincode path")
	}

	// code root will point to the directory where the code exists
	var gopath string
	gopath, err := getCodeFromFS(path)
	if err != nil {
		return nil, fmt.Errorf("Error getting code %s", err)
	}

	return &CodeDescriptor{Gopath: gopath, Pkg: path, Cleanup: nil}, nil
}
320728
func (s *JobTemplate) SetCategory(v string) *JobTemplate {
	s.Category = &v
	return s
}
1257393
func (s *Shape) GoCode() string {
	w := &bytes.Buffer{}

	switch {
	case s.EventStreamAPI != nil:
		if err := renderEventStreamAPIShape(w, s); err != nil {
			panic(
				fmt.Sprintf(
					"failed to generate eventstream API shape, %s, %v",
					s.ShapeName, err),
			)
		}
	case s.Type == "structure":
		if err := structShapeTmpl.Execute(w, s); err != nil {
			panic(
				fmt.Sprintf(
					"Failed to generate struct shape %s, %v",
					s.ShapeName, err),
			)
		}
	case s.IsEnum():
		if err := enumShapeTmpl.Execute(w, s); err != nil {
			panic(
				fmt.Sprintf(
					"Failed to generate enum shape %s, %v",
					s.ShapeName, err),
			)
		}
	default:
		panic(fmt.Sprintln("Cannot generate toplevel shape for", s.Type))
	}

	return w.String()
}
732967
func errorCode(err error) codes.Code {
	switch errors.Unwrap(err) {
	case context.DeadlineExceeded:
		return codes.DeadlineExceeded

	case context.Canceled:
		return codes.Canceled

	default:
		return grpc.Code(err)
	}
}
127734
func (s *TrustedAdvisorCheckDescription) SetCategory(v string) *TrustedAdvisorCheckDescription {
	s.Category = &v
	return s
}
511652
func ServiceGoCode(svc *gen.ServiceMetadata, chars []*gen.CharacteristicMetadata) ([]byte, error) {
	var err error
	var buf bytes.Buffer

	data := ServiceDecl(svc, chars)

	t := template.New("Test Template")

	t, err = t.Parse(ServiceStructTemplate)
	t.Execute(&buf, data)

	return buf.Bytes(), err
}
356606
func (o *Operation) GoCode() string {
	var buf bytes.Buffer

	if len(o.OutputRef.Shape.EventStreamsMemberName) != 0 {
		o.API.AddSDKImport("aws/client")
		o.API.AddSDKImport("private/protocol")
		o.API.AddSDKImport("private/protocol/rest")
		o.API.AddSDKImport("private/protocol", o.API.ProtocolPackage())
	}

	if o.API.EndpointDiscoveryOp != nil {
		o.API.AddSDKImport("aws/crr")
		o.API.AddImport("time")
		o.API.AddImport("net/url")
	}

	if o.Endpoint != nil && len(o.Endpoint.HostPrefix) != 0 {
		setupEndpointHostPrefix(o)
	}

	err := operationTmpl.Execute(&buf, o)
	if err != nil {
		panic(err)
	}

	return strings.TrimSpace(buf.String())
}
332087
func (s *UpdatePresetInput) SetCategory(v string) *UpdatePresetInput {
	s.Category = &v
	return s
}
178643
func (c *Conn) DeleteCategory(cat *Category) error {
	return c.do("smugmug.categories.delete", nil, "CategoryID", itoa64(cat.ID))
}
992032
func (s *Category) SetCode(v string) *Category {
	s.Code = &v
	return s
}
392725
func Code(err error) codes.Code {
	if code, ok := Tag.In(err); ok {
		return code
	}
	// TODO(nodir): use status.FromError
	return grpc.Code(errors.Unwrap(err))
}
1240103
func (a *StartArgs) SetCategories(categories string) *StartArgs {
	a.Categories = &categories
	return a
}
957088
func AWSErrorCode(err error) string {
	if awsError, ok := err.(awserr.Error); ok {
		return awsError.Code()
	}
	return ""
}
247489
func (s *Status) Code() codes.Code {
	if s == nil || s.s == nil {
		return codes.OK
	}
	return codes.Code(s.s.Code)
}
949069
func (a *API) ServiceGoCode() string {
	a.resetImports()
	a.AddSDKImport("aws")
	a.AddSDKImport("aws/client")
	a.AddSDKImport("aws/client/metadata")
	a.AddSDKImport("aws/request")
	if a.Metadata.SignatureVersion == "v2" {
		a.AddSDKImport("private/signer/v2")
		a.AddSDKImport("aws/corehandlers")
	} else {
		a.AddSDKImport("aws/signer/v4")
	}
	a.AddSDKImport("private/protocol", a.ProtocolPackage())
	if a.EndpointDiscoveryOp != nil {
		a.AddSDKImport("aws/crr")
	}

	var buf bytes.Buffer
	err := tplService.Execute(&buf, a)
	if err != nil {
		panic(err)
	}

	code := a.importsGoCode() + buf.String()
	return code
}
1341833
func (s *ListSigningPlatformsInput) SetCategory(v string) *ListSigningPlatformsInput {
	s.Category = &v
	return s
}