// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.36.6
// 	protoc        v3.19.0
// source: external/iam/v2/tokens.proto

package v2

import (
	context "context"
	_ "github.com/chef/automate/api/external/annotations/iam"
	request "github.com/chef/automate/api/external/iam/v2/request"
	response "github.com/chef/automate/api/external/iam/v2/response"
	_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"
	_ "google.golang.org/genproto/googleapis/api/annotations"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	reflect "reflect"
	unsafe "unsafe"
)

const (
	// Verify that this generated code is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
	// Verify that runtime/protoimpl is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

var File_external_iam_v2_tokens_proto protoreflect.FileDescriptor

const file_external_iam_v2_tokens_proto_rawDesc = "" +
	"\n" +
	"\x1cexternal/iam/v2/tokens.proto\x12\x18chef.automate.api.iam.v2\x1a\x1cgoogle/api/annotations.proto\x1a,protoc-gen-swagger/options/annotations.proto\x1a$external/iam/v2/request/tokens.proto\x1a%external/iam/v2/response/tokens.proto\x1a*external/annotations/iam/annotations.proto2\xbf\t\n" +
	"\x06Tokens\x12\xce\x02\n" +
	"\vCreateToken\x12(.chef.automate.api.iam.v2.CreateTokenReq\x1a).chef.automate.api.iam.v2.CreateTokenResp\"\xe9\x01\x92A\xa4\x01\n" +
	"\x06tokensj\x99\x01\n" +
	"\x0ex-code-samples\x12\x86\x012\x83\x01\n" +
	"\x80\x01*~\n" +
	"\x0e\n" +
	"\x04lang\x12\x06\x1a\x04JSON\n" +
	"l\n" +
	"\x06source\x12b\x1a`{\"name\": \"token 1\", \"id\": \"token-1\", \"active\": true, \"projects\": [\"east-region\", \"west-region\"]}\x8a\xb5\x18\x1f\n" +
	"\n" +
	"iam:tokens\x12\x11iam:tokens:create\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/apis/iam/v2/tokens\x12\xab\x01\n" +
	"\bGetToken\x12%.chef.automate.api.iam.v2.GetTokenReq\x1a&.chef.automate.api.iam.v2.GetTokenResp\"P\x92A\b\n" +
	"\x06tokens\x8a\xb5\x18!\n" +
	"\x0fiam:tokens:{id}\x12\x0eiam:tokens:get\x82\xd3\xe4\x93\x02\x1a\x12\x18/apis/iam/v2/tokens/{id}\x12\xd0\x02\n" +
	"\vUpdateToken\x12(.chef.automate.api.iam.v2.UpdateTokenReq\x1a).chef.automate.api.iam.v2.UpdateTokenResp\"\xeb\x01\x92A\x9c\x01\n" +
	"\x06tokensj\x91\x01\n" +
	"\x0ex-code-samples\x12\x7f2}\n" +
	"{*y\n" +
	"\x0e\n" +
	"\x04lang\x12\x06\x1a\x04JSON\n" +
	"g\n" +
	"\x06source\x12]\x1a[{\"name\": \"updated token name\", \"active\": true, \"projects\": [\"east-region\", \"south-region\"]}\x8a\xb5\x18$\n" +
	"\x0fiam:tokens:{id}\x12\x11iam:tokens:update\x82\xd3\xe4\x93\x02\x1d:\x01*\x1a\x18/apis/iam/v2/tokens/{id}\x12\xb7\x01\n" +
	"\vDeleteToken\x12(.chef.automate.api.iam.v2.DeleteTokenReq\x1a).chef.automate.api.iam.v2.DeleteTokenResp\"S\x92A\b\n" +
	"\x06tokens\x8a\xb5\x18$\n" +
	"\x0fiam:tokens:{id}\x12\x11iam:tokens:delete\x82\xd3\xe4\x93\x02\x1a*\x18/apis/iam/v2/tokens/{id}\x12\xa8\x01\n" +
	"\n" +
	"ListTokens\x12'.chef.automate.api.iam.v2.ListTokensReq\x1a(.chef.automate.api.iam.v2.ListTokensResp\"G\x92A\b\n" +
	"\x06tokens\x8a\xb5\x18\x1d\n" +
	"\n" +
	"iam:tokens\x12\x0fiam:tokens:list\x82\xd3\xe4\x93\x02\x15\x12\x13/apis/iam/v2/tokensB.Z,github.com/chef/automate/api/external/iam/v2b\x06proto3"

var file_external_iam_v2_tokens_proto_goTypes = []any{
	(*request.CreateTokenReq)(nil),   // 0: chef.automate.api.iam.v2.CreateTokenReq
	(*request.GetTokenReq)(nil),      // 1: chef.automate.api.iam.v2.GetTokenReq
	(*request.UpdateTokenReq)(nil),   // 2: chef.automate.api.iam.v2.UpdateTokenReq
	(*request.DeleteTokenReq)(nil),   // 3: chef.automate.api.iam.v2.DeleteTokenReq
	(*request.ListTokensReq)(nil),    // 4: chef.automate.api.iam.v2.ListTokensReq
	(*response.CreateTokenResp)(nil), // 5: chef.automate.api.iam.v2.CreateTokenResp
	(*response.GetTokenResp)(nil),    // 6: chef.automate.api.iam.v2.GetTokenResp
	(*response.UpdateTokenResp)(nil), // 7: chef.automate.api.iam.v2.UpdateTokenResp
	(*response.DeleteTokenResp)(nil), // 8: chef.automate.api.iam.v2.DeleteTokenResp
	(*response.ListTokensResp)(nil),  // 9: chef.automate.api.iam.v2.ListTokensResp
}
var file_external_iam_v2_tokens_proto_depIdxs = []int32{
	0, // 0: chef.automate.api.iam.v2.Tokens.CreateToken:input_type -> chef.automate.api.iam.v2.CreateTokenReq
	1, // 1: chef.automate.api.iam.v2.Tokens.GetToken:input_type -> chef.automate.api.iam.v2.GetTokenReq
	2, // 2: chef.automate.api.iam.v2.Tokens.UpdateToken:input_type -> chef.automate.api.iam.v2.UpdateTokenReq
	3, // 3: chef.automate.api.iam.v2.Tokens.DeleteToken:input_type -> chef.automate.api.iam.v2.DeleteTokenReq
	4, // 4: chef.automate.api.iam.v2.Tokens.ListTokens:input_type -> chef.automate.api.iam.v2.ListTokensReq
	5, // 5: chef.automate.api.iam.v2.Tokens.CreateToken:output_type -> chef.automate.api.iam.v2.CreateTokenResp
	6, // 6: chef.automate.api.iam.v2.Tokens.GetToken:output_type -> chef.automate.api.iam.v2.GetTokenResp
	7, // 7: chef.automate.api.iam.v2.Tokens.UpdateToken:output_type -> chef.automate.api.iam.v2.UpdateTokenResp
	8, // 8: chef.automate.api.iam.v2.Tokens.DeleteToken:output_type -> chef.automate.api.iam.v2.DeleteTokenResp
	9, // 9: chef.automate.api.iam.v2.Tokens.ListTokens:output_type -> chef.automate.api.iam.v2.ListTokensResp
	5, // [5:10] is the sub-list for method output_type
	0, // [0:5] is the sub-list for method input_type
	0, // [0:0] is the sub-list for extension type_name
	0, // [0:0] is the sub-list for extension extendee
	0, // [0:0] is the sub-list for field type_name
}

func init() { file_external_iam_v2_tokens_proto_init() }
func file_external_iam_v2_tokens_proto_init() {
	if File_external_iam_v2_tokens_proto != nil {
		return
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: unsafe.Slice(unsafe.StringData(file_external_iam_v2_tokens_proto_rawDesc), len(file_external_iam_v2_tokens_proto_rawDesc)),
			NumEnums:      0,
			NumMessages:   0,
			NumExtensions: 0,
			NumServices:   1,
		},
		GoTypes:           file_external_iam_v2_tokens_proto_goTypes,
		DependencyIndexes: file_external_iam_v2_tokens_proto_depIdxs,
	}.Build()
	File_external_iam_v2_tokens_proto = out.File
	file_external_iam_v2_tokens_proto_goTypes = nil
	file_external_iam_v2_tokens_proto_depIdxs = nil
}

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6

// TokensClient is the client API for Tokens service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type TokensClient interface {
	// Creates a token
	//
	// Creates a token.
	// Active defaults to true when not specified.
	// Value is auto-generated when not specified.
	//
	// Note that this creates *non-admin* tokens that may then be assigned permissions via policies just like users or teams (unless you have already created policies that encompass all tokens using `tokens:*“).
	//
	// You cannot create admin tokens via the REST API.
	// Admin tokens can only be created by specifying the `--admin` flag to this chef-automate sub-command:
	// ```
	// chef-automate iam token create <your-token-name> --admin`
	// ```
	//
	// Authorization Action:
	// ```
	// ```
	//
	//iam:tokens:create
	CreateToken(ctx context.Context, in *request.CreateTokenReq, opts ...grpc.CallOption) (*response.CreateTokenResp, error)
	// Gets a token
	//
	// Returns the details for a token.
	//
	// Authorization Action:
	// ```
	// ```
	//
	//iam:tokens:get
	GetToken(ctx context.Context, in *request.GetTokenReq, opts ...grpc.CallOption) (*response.GetTokenResp, error)
	// Updates a token
	//
	// This operation overwrites all fields excepting ID, timestamps, and value,
	// including those omitted from the request, so be sure to specify all properties.
	// Properties that you do not include are reset to empty values.
	//
	// Authorization Action:
	// ```
	// ```
	//
	//iam:tokens:update
	UpdateToken(ctx context.Context, in *request.UpdateTokenReq, opts ...grpc.CallOption) (*response.UpdateTokenResp, error)
	// Deletes a token
	//
	// Deletes a token and remove it from any policies.
	//
	// Authorization Action:
	// ```
	// ```
	//
	//iam:tokens:delete
	DeleteToken(ctx context.Context, in *request.DeleteTokenReq, opts ...grpc.CallOption) (*response.DeleteTokenResp, error)
	// Lists all tokens
	//
	// Lists all tokens, both admin and non-admin.
	//
	// Authorization Action:
	// ```
	// ```
	//
	//iam:tokens:list
	ListTokens(ctx context.Context, in *request.ListTokensReq, opts ...grpc.CallOption) (*response.ListTokensResp, error)
}

type tokensClient struct {
	cc grpc.ClientConnInterface
}

func NewTokensClient(cc grpc.ClientConnInterface) TokensClient {
	return &tokensClient{cc}
}

func (c *tokensClient) CreateToken(ctx context.Context, in *request.CreateTokenReq, opts ...grpc.CallOption) (*response.CreateTokenResp, error) {
	out := new(response.CreateTokenResp)
	err := c.cc.Invoke(ctx, "/chef.automate.api.iam.v2.Tokens/CreateToken", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *tokensClient) GetToken(ctx context.Context, in *request.GetTokenReq, opts ...grpc.CallOption) (*response.GetTokenResp, error) {
	out := new(response.GetTokenResp)
	err := c.cc.Invoke(ctx, "/chef.automate.api.iam.v2.Tokens/GetToken", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *tokensClient) UpdateToken(ctx context.Context, in *request.UpdateTokenReq, opts ...grpc.CallOption) (*response.UpdateTokenResp, error) {
	out := new(response.UpdateTokenResp)
	err := c.cc.Invoke(ctx, "/chef.automate.api.iam.v2.Tokens/UpdateToken", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *tokensClient) DeleteToken(ctx context.Context, in *request.DeleteTokenReq, opts ...grpc.CallOption) (*response.DeleteTokenResp, error) {
	out := new(response.DeleteTokenResp)
	err := c.cc.Invoke(ctx, "/chef.automate.api.iam.v2.Tokens/DeleteToken", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *tokensClient) ListTokens(ctx context.Context, in *request.ListTokensReq, opts ...grpc.CallOption) (*response.ListTokensResp, error) {
	out := new(response.ListTokensResp)
	err := c.cc.Invoke(ctx, "/chef.automate.api.iam.v2.Tokens/ListTokens", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// TokensServer is the server API for Tokens service.
type TokensServer interface {
	// Creates a token
	//
	// Creates a token.
	// Active defaults to true when not specified.
	// Value is auto-generated when not specified.
	//
	// Note that this creates *non-admin* tokens that may then be assigned permissions via policies just like users or teams (unless you have already created policies that encompass all tokens using `tokens:*“).
	//
	// You cannot create admin tokens via the REST API.
	// Admin tokens can only be created by specifying the `--admin` flag to this chef-automate sub-command:
	// ```
	// chef-automate iam token create <your-token-name> --admin`
	// ```
	//
	// Authorization Action:
	// ```
	// ```
	//
	//iam:tokens:create
	CreateToken(context.Context, *request.CreateTokenReq) (*response.CreateTokenResp, error)
	// Gets a token
	//
	// Returns the details for a token.
	//
	// Authorization Action:
	// ```
	// ```
	//
	//iam:tokens:get
	GetToken(context.Context, *request.GetTokenReq) (*response.GetTokenResp, error)
	// Updates a token
	//
	// This operation overwrites all fields excepting ID, timestamps, and value,
	// including those omitted from the request, so be sure to specify all properties.
	// Properties that you do not include are reset to empty values.
	//
	// Authorization Action:
	// ```
	// ```
	//
	//iam:tokens:update
	UpdateToken(context.Context, *request.UpdateTokenReq) (*response.UpdateTokenResp, error)
	// Deletes a token
	//
	// Deletes a token and remove it from any policies.
	//
	// Authorization Action:
	// ```
	// ```
	//
	//iam:tokens:delete
	DeleteToken(context.Context, *request.DeleteTokenReq) (*response.DeleteTokenResp, error)
	// Lists all tokens
	//
	// Lists all tokens, both admin and non-admin.
	//
	// Authorization Action:
	// ```
	// ```
	//
	//iam:tokens:list
	ListTokens(context.Context, *request.ListTokensReq) (*response.ListTokensResp, error)
}

// UnimplementedTokensServer can be embedded to have forward compatible implementations.
type UnimplementedTokensServer struct {
}

func (*UnimplementedTokensServer) CreateToken(context.Context, *request.CreateTokenReq) (*response.CreateTokenResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method CreateToken not implemented")
}
func (*UnimplementedTokensServer) GetToken(context.Context, *request.GetTokenReq) (*response.GetTokenResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetToken not implemented")
}
func (*UnimplementedTokensServer) UpdateToken(context.Context, *request.UpdateTokenReq) (*response.UpdateTokenResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method UpdateToken not implemented")
}
func (*UnimplementedTokensServer) DeleteToken(context.Context, *request.DeleteTokenReq) (*response.DeleteTokenResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method DeleteToken not implemented")
}
func (*UnimplementedTokensServer) ListTokens(context.Context, *request.ListTokensReq) (*response.ListTokensResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListTokens not implemented")
}

func RegisterTokensServer(s *grpc.Server, srv TokensServer) {
	s.RegisterService(&_Tokens_serviceDesc, srv)
}

func _Tokens_CreateToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(request.CreateTokenReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TokensServer).CreateToken(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/chef.automate.api.iam.v2.Tokens/CreateToken",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TokensServer).CreateToken(ctx, req.(*request.CreateTokenReq))
	}
	return interceptor(ctx, in, info, handler)
}

func _Tokens_GetToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(request.GetTokenReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TokensServer).GetToken(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/chef.automate.api.iam.v2.Tokens/GetToken",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TokensServer).GetToken(ctx, req.(*request.GetTokenReq))
	}
	return interceptor(ctx, in, info, handler)
}

func _Tokens_UpdateToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(request.UpdateTokenReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TokensServer).UpdateToken(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/chef.automate.api.iam.v2.Tokens/UpdateToken",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TokensServer).UpdateToken(ctx, req.(*request.UpdateTokenReq))
	}
	return interceptor(ctx, in, info, handler)
}

func _Tokens_DeleteToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(request.DeleteTokenReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TokensServer).DeleteToken(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/chef.automate.api.iam.v2.Tokens/DeleteToken",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TokensServer).DeleteToken(ctx, req.(*request.DeleteTokenReq))
	}
	return interceptor(ctx, in, info, handler)
}

func _Tokens_ListTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(request.ListTokensReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TokensServer).ListTokens(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/chef.automate.api.iam.v2.Tokens/ListTokens",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TokensServer).ListTokens(ctx, req.(*request.ListTokensReq))
	}
	return interceptor(ctx, in, info, handler)
}

var _Tokens_serviceDesc = grpc.ServiceDesc{
	ServiceName: "chef.automate.api.iam.v2.Tokens",
	HandlerType: (*TokensServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateToken",
			Handler:    _Tokens_CreateToken_Handler,
		},
		{
			MethodName: "GetToken",
			Handler:    _Tokens_GetToken_Handler,
		},
		{
			MethodName: "UpdateToken",
			Handler:    _Tokens_UpdateToken_Handler,
		},
		{
			MethodName: "DeleteToken",
			Handler:    _Tokens_DeleteToken_Handler,
		},
		{
			MethodName: "ListTokens",
			Handler:    _Tokens_ListTokens_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "external/iam/v2/tokens.proto",
}
