opsgenie / opsgenie-lamp

OpsGenie Lamp with Go SDK
Apache License 2.0
34 stars 18 forks source link

Cannot use the name of a policy, only the ID. #13

Closed heinrichnak closed 4 years ago

heinrichnak commented 5 years ago

Documentation says I can use either the name or the id of the policy:

--id value Id of the integration/policy that will be enabled. Either id or name must be provided

But when I use the name of the policy I get this error:

INFO[2019-08-07T12:24:58.5856735+02:00] Client is configured with ApiUrl: api.opsgenie.com, LogLevel: trace, RetryMaxCount: 4
DEBU[2019-08-07T12:24:58.5862319+02:00] Starting to process Request &{BaseRequest:{} Id:rolling_restart_jmbpapp11 TeamId:a2ac9607-3836-45bb-a88e-5a671498e19e Type:alert}: to send: /v2/policies/rolling_restart_jmbpapp11/enable
ERRO[2019-08-07T12:24:58.9699229+02:00] Error occurred with Status code: 404, Message: Policy not found with id [rolling_restart_jmbpapp11] and team id [a2ac9607-3836-45bb-a88e-5a671498e19e], Took: 0.003000, RequestId: 2c48a1b9-9f6c-4dee-bb34-1760029c3f25
Error occurred with Status code: 404, Message: Policy not found with id [rolling_restart_jmbpapp11] and team id [a2ac9607-3836-45bb-a88e-5a671498e19e], Took: 0.003000, RequestId: 2c48a1b9-9f6c-4dee-bb34-1760029c3f25

Same command with the id of the policy does complete successfully:

DEBU[2019-08-07T12:25:47.5706651+02:00] Starting to process Request &{BaseRequest:{} Id:17fede29-b0e9-4c21-a901-8818f891454b TeamId:a2ac9607-3836-45bb-a88e-5a671498e19e Type:alert}: to send: /v2/policies/17fede29-b0e9-4c21-a901-8818f891454b/enable
DEBU[2019-08-07T12:25:48.1805478+02:00] Request processed. The result: &{ResultMetadata:{RequestId:c9db0283-9391-4687-bdb9-e5477b9a5aaa ResponseTime:0.13 RateLimitState:OK RateLimitReason: RateLimitPeriod: RetryCount:0} Result:Enabled}
Policy enabled successfuly

Name of the policy is correct: {"id":"17fede29-b0e9-4c21-a901-8818f891454b","name":"rolling_restart_jmbpapp11"

Also tried --name, different error: Incorrect Usage: flag provided but not defined: -name

cemkucuk commented 4 years ago

hey @heinrichnak, can you confirm that the problem still exists?

heinrichnak commented 4 years ago

Hi @cemkucuk , not been here for a while. We never looked at it again.