// Code generated by protoc-gen-policy. DO NOT EDIT.
// source: external/iam/v2/users.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.Users/CreateUser", "iam:users", "iam:users:create", "POST", "/apis/iam/v2/users", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.CreateUserReq); ok {
			return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string {
				switch want {
				case "id":
					return m.Id
				case "name":
					return m.Name
				case "password":
					return m.Password
				default:
					return ""
				}
			})
		}
		return ""
	})
	policy.MapMethodTo("/chef.automate.api.iam.v2.Users/ListUsers", "iam:users", "iam:users:list", "GET", "/apis/iam/v2/users", func(unexpandedResource string, input interface{}) string {
		return unexpandedResource
	})
	policy.MapMethodTo("/chef.automate.api.iam.v2.Users/GetUser", "iam:users:{id}", "iam:users:get", "GET", "/apis/iam/v2/users/{id}", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.GetUserReq); 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.Users/DeleteUser", "iam:users:{id}", "iam:users:delete", "DELETE", "/apis/iam/v2/users/{id}", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.DeleteUserReq); 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.Users/UpdateUser", "iam:users:{id}", "iam:users:update", "PUT", "/apis/iam/v2/users/{id}", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.UpdateUserReq); ok {
			return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string {
				switch want {
				case "id":
					return m.Id
				case "name":
					return m.Name
				case "password":
					return m.Password
				default:
					return ""
				}
			})
		}
		return ""
	})
	policy.MapMethodTo("/chef.automate.api.iam.v2.Users/UpdateSelf", "iam:usersSelf:{id}", "iam:usersSelf:update", "PUT", "/apis/iam/v2/self/{id}", func(unexpandedResource string, input interface{}) string {
		if m, ok := input.(*request.UpdateSelfReq); ok {
			return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string {
				switch want {
				case "id":
					return m.Id
				case "name":
					return m.Name
				case "password":
					return m.Password
				case "previous_password":
					return m.PreviousPassword
				default:
					return ""
				}
			})
		}
		return ""
	})
}
