0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AWS AppSyncでAPIを作ってみたAdvent Calendar 2022

Day 21

IAMを使ったAppSyncの認証設定

Last updated at Posted at 2022-12-20

概要

この記事では、IAMを使ったAppSyncの認証方法を紹介します。

スキーマ

アドベントカレンダーの1日目から5日目で作成したAppSyncをIAMでの認証に切り替えます。

input CreateRadioInput {
	id: ID!
	program_name: String
	cast: [String!]
	weekday: Int
	time: String
	favorite: Boolean
}

input DeleteRadioInput {
	id: ID!
}

type Mutation {
	createRadio(input: CreateRadioInput!): Radio
		@aws_iam
	updateRadio(input: UpdateRadioInput!): Radio
		@aws_iam
	deleteRadio(input: DeleteRadioInput!): Radio
		@aws_iam
}

type Query {
	getRadio(id: ID!): Radio
		@aws_iam
	listRadio(filter: TableRadioFilterInput, limit: Int, nextToken: String): RadioConnection
		@aws_iam
}

type Radio @aws_iam {
	id: ID!
	program_name: String
	cast: [String!]
	weekday: Int
	time: String
	favorite: Boolean
}

type RadioConnection @aws_iam {
	items: [Radio]
	nextToken: String
}

input TableBooleanFilterInput {
	ne: Boolean
	eq: Boolean
}

input TableIntFilterInput {
	ne: Int
	eq: Int
	le: Int
	lt: Int
	ge: Int
	gt: Int
	contains: Int
	notContains: Int
	between: [Int]
}

input TableRadioFilterInput {
	day: TableIntFilterInput
	time: TableStringFilterInput
	favorite: TableBooleanFilterInput
}

input TableStringFilterInput {
	ne: String
	eq: String
	le: String
	lt: String
	ge: String
	gt: String
	contains: String
	notContains: String
	between: [String]
	beginsWith: String
}

input UpdateRadioInput {
	id: ID!
	program_name: String
	cast: [String!]
	day: Int
	time: String
	favorite: Boolean
}

MutationQuerytype Radiotype RadioConnection
@aws_iamを追加することでIAMでの認証を受け付けます。

リゾルバーの変更は不要です。

確認方法

curlでの確認方法は、アドベントカレンダーの23日目の記事を参照ください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?