// Code generated by protoc-gen-policy. DO NOT EDIT.
// source: external/iam/v2/teams.proto

package v2

import (
	policy "github.com/chef/automate/api/external/iam/v2/policy"
	request "github.com/chef/automate/api/external/iam/v2/request"
)

func init() {
	policy.MapMethodTo("/chef.automate.api.iam.v2.Teams/CreateTeam", "iam:teams", "iam:teams:create", "POST", "/apis/iam/v2/teams", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.CreateTeamReq); ok {
			return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string {
				switch want {
				case "id":
					return m.Id
				case "name":
					return m.Name
				default:
					return ""
				}
			})
		}
		return ""
	})
	policy.MapMethodTo("/chef.automate.api.iam.v2.Teams/ListTeams", "iam:teams", "iam:teams:list", "GET", "/apis/iam/v2/teams", func(unexpandedResource string, input interface{}) string {
		return unexpandedResource
	})
	policy.MapMethodTo("/chef.automate.api.iam.v2.Teams/GetTeam", "iam:teams:{id}", "iam:teams:get", "GET", "/apis/iam/v2/teams/{id}", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.GetTeamReq); ok {
			return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string {
				switch want {
				case "id":
					return m.Id
				default:
					return ""
				}
			})
		}
		return ""
	})
	policy.MapMethodTo("/chef.automate.api.iam.v2.Teams/UpdateTeam", "iam:teams:{id}", "iam:teams:update", "PUT", "/apis/iam/v2/teams/{id}", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.UpdateTeamReq); ok {
			return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string {
				switch want {
				case "id":
					return m.Id
				case "name":
					return m.Name
				default:
					return ""
				}
			})
		}
		return ""
	})
	policy.MapMethodTo("/chef.automate.api.iam.v2.Teams/DeleteTeam", "iam:teams:{id}", "iam:teams:delete", "DELETE", "/apis/iam/v2/teams/{id}", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.DeleteTeamReq); ok {
			return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string {
				switch want {
				case "id":
					return m.Id
				default:
					return ""
				}
			})
		}
		return ""
	})
	policy.MapMethodTo("/chef.automate.api.iam.v2.Teams/GetTeamMembership", "iam:teams:{id}:users", "iam:teamUsers:list", "GET", "/apis/iam/v2/teams/{id}/users", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.GetTeamMembershipReq); ok {
			return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string {
				switch want {
				case "id":
					return m.Id
				default:
					return ""
				}
			})
		}
		return ""
	})
	policy.MapMethodTo("/chef.automate.api.iam.v2.Teams/AddTeamMembers", "iam:teams:{id}", "iam:teamUsers:create", "POST", "/apis/iam/v2/teams/{id}/users:add", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.AddTeamMembersReq); ok {
			return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string {
				switch want {
				case "id":
					return m.Id
				default:
					return ""
				}
			})
		}
		return ""
	})
	policy.MapMethodTo("/chef.automate.api.iam.v2.Teams/RemoveTeamMembers", "iam:teams:{id}", "iam:teamUsers:delete", "POST", "/apis/iam/v2/teams/{id}/users:remove", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.RemoveTeamMembersReq); ok {
			return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string {
				switch want {
				case "id":
					return m.Id
				default:
					return ""
				}
			})
		}
		return ""
	})
	policy.MapMethodTo("/chef.automate.api.iam.v2.Teams/GetTeamsForMember", "iam:users:{membership_id}:teams", "iam:userTeams:get", "GET", "/apis/iam/v2/users/{membership_id}/teams", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.GetTeamsForMemberReq); ok {
			return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string {
				switch want {
				case "membership_id":
					return m.MembershipId
				default:
					return ""
				}
			})
		}
		return ""
	})
}
